@products["car"] is not being recognized in my tests! help

@products[“car”] is not being recognized in my tests:

class ProductsControllerTest < Test::Unit::TestCase
fixtures :products

def test_view_product
post :view_product, :id=>@products[“car”].id
assert_template “view_product”

end

end

products.yml :

car:
id:1
name:test

Does anyone have any idea why its not working?
Im having to do this instead, which is not ideal:
post :view_product, :id=>1

Thanks
Chris

Does using product(“car”).id instead of @products[“car”].id fix your
problem?

Cheers,

Dan.

Dan Venkitachalam wrote:

Does using product(“car”).id instead of @products[“car”].id fix your
problem?

Cheers,

Dan.

Yeah that seems to work. Though according to the “Agile Development
with rails” book :

“When a fixture is loaded, its put into a Hash object referenced by an
instance variable of the test case. For example the :products fixture
is convieniently loaded into the @products instance variable.”

That goes against what you suggested and what seems to work. Any Ideas
whats going on? Its hard to believe they’ve changed the way it works so
drastically,

Thanks
Chris

Hello Chris,

2006/5/4, Chris R. [email protected]:

That goes against what you suggested and what seems to work.
Any Ideas whats going on? Its hard to believe they’ve changed
the way it works so drastically,

yes, they have.

Read : http://clarkware.com/cgi/blosxom/2005/10/24

-- Jean-François.

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