Anything wrong with this test? Cannot access fixture

Hi,

I have problem accessing the testfixture. The values from the
YML-Fixture-File are correctly written into database, but accessing the
fixture is impossible. It is always nil.

Is anything wrong with this test?

class MyModelTest < Test::Unit::TestCase
fixtures :my_model

def test_simple
a = MyModel.find(@my_model[“first”].id) # Accessing @my_model is
impossible

end
end

Thanks,
Steffen

I found out the correct syntax: my_model(:first)
It’s a bit confusion because the book AWDWR says @fixture[“fixturename”]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs