[rspec-users] Oddness with fieldnames containing an underscore

John Meredith johnm at psynix.com
Wed Dec 10 18:36:10 EST 2008


Hi all,

I'm not sure if this is a cucumber or webrat thing given that I only  
starting tinkering with both last night for the first time (testing  
newb as well), but I've come across an oddity when trying to write a  
scenario to create a user.

   Scenario: Register new user
     Given I am on the new user page
     And I fill in "login" with "fredf"
     And I fill in "password" with "somepassword"
     And I fill in "password_confirmation" with "somepassword"
     And I select "Mr" from "title"
     And I fill in "given_names" with "Fred"
     And I fill in "surname" with "Flintstone"
     And I fill in "email" with "fredf at rocks.com"
     And I press "Create"
     Then there should be 1 more user

When I 'rake features' it halts at the password_confirmation line...

   Scenario: Register new user                             # features/ 
manage_users.feature:16
     Given I am on the new user page                       # features/ 
step_definitions/user_steps.rb:5
     And I fill in "login" with "johnm"                    # features/ 
step_definitions/webrat_steps.rb:12
     And I fill in "password" with "Lmmsoht"               # features/ 
step_definitions/webrat_steps.rb:12
     And I fill in "password_confirmation" with "Lmmsoht"  # features/ 
step_definitions/webrat_steps.rb:12
       Could not find field:  
"password_confirmation" (Webrat::NotFoundError)

The test passes if I prepend "user_" to the field name ie.  
"user_password_confirmation". Same applies to the 'given_names' field.

Is this a bug or am I making an incorrect assumption on how things are  
supposed to work?

TIA,

   JohnM

--

"I'm not dumb. I just have a command of thoroughly useless information"
   - Calvin & Hobbes




More information about the rspec-users mailing list