Hello, Below is a test case which shows strange fixtures behaviour (tested against edge revision 7955). Is this behaviour correct or should I fill a bug report? class StrangeFixturesBehaviourTest < Test::Unit::TestCase fixtures :topics def test_disturbed_fixtures topics(:first) # causes trouble later content = "Have a drink! Enjoy! Welcome to paradise!" Topic.find(1).update_attributes(:content => content) assert_equal content, topics(:first).content # fails end def test_undisturbed_fixtures content = "Have a drink! Enjoy! Welcome to paradise!" Topic.find(2).update_attributes(:content => content) assert_equal content, topics(:second).content # passes end end -- Jacek Becela --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/17/07, Jacek Becela <jacek.becela@gmail.com> wrote:> Below is a test case which shows strange fixtures behaviour (tested > against edge revision 7955). Is this behaviour correct or should I > fill a bug report?This is expected behavior. Maybe this helps to understand: topic = Topic.find(1) Topic.find(1).update_attributes(:content => ''foo'') assert_not_equal ''foo'', topic.content assert_equal ''foo'', topic.reload.content So use topics(:first).reload to pull the intervening update from the db. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for quick reply. -- Jacek On Oct 17, 10:08 pm, "Jeremy Kemper" <jer...@bitsweat.net> wrote:> On 10/17/07, Jacek Becela <jacek.bec...@gmail.com> wrote: > > > Below is a test case which shows strange fixtures behaviour (tested > > against edge revision 7955). Is this behaviour correct or should I > > fill a bug report? > > This is expected behavior. Maybe this helps to understand: > topic = Topic.find(1) > Topic.find(1).update_attributes(:content => ''foo'') > assert_not_equal ''foo'', topic.content > assert_equal ''foo'', topic.reload.content > > So use topics(:first).reload to pull the intervening update from the db. > > jeremy--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---