Hi!
I´m pretty new with RoR and have a problem with the Unit Test in P. Lenz Book on page 224.
This test ...
... end in this failure:Code Ruby:def test_votes_association assert_equal [ votes(:first), votes(:second) ], stories(:first).votes end
test_votes_association(StoryTest) [./test/unit/story_test.rb:24]:
<[#<Vote:0x9a25c0c
@attributes=
{"story_id"=>"1", "id"=>"1", "created_at"=>"2007-12-29 01:19:57"}>,
#<Vote:0x9a2525c
@attributes=
{"story_id"=>"1", "id"=>"2", "created_at"=>"2007-12-29 01:19:57"}>]> expected but was
<[#<Vote:0x9a23c54 @attributes={"story_id"=>"1", "id"=>"2", "created_at"=>"2007-12-29 01:19:57"}>, #<Vote:0x9a23c2c @attributes={"story_id"=>"1", "id"=>"1", "created_at"=>"2007-12-29 01:19:57"}>]>.
When i reverse the array like this ...
... the test end in success.Code Ruby:def test_votes_association assert_equal [ votes(:second), votes(:first) ], stories(:first).votes end
Did anyone know the reason for this?
Thank you very much!



Bookmarks