Thursday, April 21, 2011

Getting "undefined method" error on form select in cucumber

I'm trying to visit a page with cucumber, with:

visit new_video_path

but I get this error:

undefined method `episode_id' for #<Video:0x22df8dc> (ActionView::TemplateError)
On line #19 of app/views/videos/_form.html.erb
...
19:     <%= select(:video, :episode_id, @episodes.collect {|e| [ e.title, e.id ] }, { :include_blank => true }) %>

It loads fine in the browser, and the form processes fine too.

What did I do wrong?

From stackoverflow
  • Ah, found the problem. I forgot to migrate the test database.

    rake db:migrate RAILS_ENV=test
    

0 comments:

Post a Comment