Skip to content

Instantly share code, notes, and snippets.

@felipero
Created July 21, 2009 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipero/151644 to your computer and use it in GitHub Desktop.
Save felipero/151644 to your computer and use it in GitHub Desktop.
Then /^the selected date for "([^"]*)" should be "([^"]*)"$/ do |field, date|
field = field.tr('[', '_')
field = field.tr(']', '_')
year_field = field + '1i'
month_field = field + '2i'
day_field = field + '3i'
date = Date.parse(date)
field_with_id(year_field).element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{date.year}/
field_with_id(month_field).element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{date.strftime('%B')}/
field_with_id(day_field).element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{date.day}/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment