Search code examples
ruby-on-railscucumberwebrat

Webrat select_date selector failure


Code in steps file:

  select_date user.date_of_birth, :from => "Date of birth"

Selector fail

When I register with valid user credentials # features/step_definitions/authentication_steps.rb:2
  Could not find field: "user_date_of_birth_1i_1i" (Webrat::NotFoundError)
  ./features/step_definitions/authentication_steps.rb:9:in `/^I register with valid user credentials$/'
  features/authentication.feature:6:in `When I register with valid user credentials'

HTML output seems to be normal:

<select name="user[date_of_birth(1i)]" id="user_date_of_birth_1i">

Is it bug, or I am doing something wrong


Solution

  • Solved using "id_prefix" argument

      select_date user.date_of_birth, :id_prefix => "user_date_of_birth"
    

    Yet it seems to be Webrat's bug.