Hi all, I am new to Ruby on Rails and struggling to finish my class project. I have problem with unit testing, if any body could help.
I have a function that updates 'feeds' table. It has a columns: id, feeddata, lastupdate. feedupdate. ------------------------------------------------------------ The function in method feed.rb is as follows: def Feed.updatefeed(feed_id) @u = Feed.find(feed_id) #response=fetch(@u.sourcelink) #...@u.feeddata=response.body @u.lastupdate=Time.now @u.save! end ------------------------------------------------------------- my test feed_test.rb is as follows: require File.dirname(__FILE__) + '/../test_helper' class FeedTest < ActiveSupport::TestCase # Replace this with your real tests. fixtures :feeds def test_truth assert true end def test_updatefeed feed1 = Feed.find(:first,:conditions=>["id=?",12]) Feed.updatefeed(feed1.id) assert_equal(Time.now, feed1.lastupdate) end end ---------------------------------------------------------------- fixture: feed_1: id: 1 sourcelink: http://sports.yahoo.com/ncaaf/teams/aad/ical.ics feeddata: testdata lastupdate: 2009-02-17 22:42:25 used: 1 ... feed_12: id: 12 sourcelink: http://icalx.com/public/wesleyrhall/Astronomy.ics feeddata: testdata lastupdate: 2009-02-17 22:42:25 used: 1 ------------------------------------------------------------- My 'updatefeed' function is working on application well. But my test doesn't show the updated 'lastupdated' column date but only the value in fixture. Shouldn't the fixture value be updated on execution and after comparison set it back? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---