The test succeeds if I change the index method in my StoriesController
class so it creates a Story object rather than retrieving one from the
test database.

Old index method...

  def index
    @current_time = Time.now

    @story = Story.find(:first, :order => 'RANDOM()')
  end

New index method...

  def index
    @current_time = Time.now

    @story = Story.new
    @story.name = 'A test'
    @story.link = 'http://a_test.com/'
  end

It seems the problem is that there is no rows in the Stories table in
the test database.

Can someone please explain how the test database is populated?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to