简体   繁体   中英

How can I use cucumber to test a form that uses the nested_form gem?

I'm using the rather lovely nested form gem by Ryan Bates. It works fine when I use it live, but I haven't found a way of testing with Cucumber. I'm not trying to test the gem itself, but the behaviour of my website after I've completed the form.

The steps I'm using are exactly the same as the ones I'd use on the site.

Then I should see "Add a question"                       # features/step_definitions/web_steps.rb:105
When I follow "Add a question"                           # features/step_definitions/web_steps.rb:56
  You have a nil object when you didn't expect it!
  You might have expected an instance of Array.
  The error occurred while evaluating nil.[] (NoMethodError)

Given that the gem uses javascript to perform the browser magic, the scenario needs the @javascript tag.

Works fine now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM