views:

183

answers:

1

I have to set a select date field with the month and day discarded. So Month and day are hidden in the form which caused a "undefined method `options' for # (NoMethodError)" when executing the cucumber scenario.

How can i solve this issue and get the year correctly into the cucumber step ?

+3  A: 

well i found a solution : Define my own cucumber steps into which i use the webrat set_hidden_field method like this :

When /^I select "([^\"]*)" as the stuff year$/ do |arg1|
  date = Date.parse(arg1)
  set_hidden_field 'stuff_year_2i', :to => date.day
  set_hidden_field 'stuff_year_3i', :to => date.month
  select(date.year, :from => 'stuff_year_1i')
end

Hope this can help someone

Does this work for checking the existence of a hidden field too?
scaney