Created
November 15, 2012 18:57
-
-
Save alg/4080472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fills the standard Rails 3-field date picker with the date. | |
# #name# is supposed to lead to one of these fields, either through a label or a CSS selector. | |
# Usage: | |
# fill_in_date "Date of birth", with: 30.years.ago | |
def fill_in_date(name, options) | |
date = options[:with] | |
within find_field(name).parent do | |
find('select[name*="2i"]').select(date.strftime('%B')) | |
find('select[name*="3i"]').select(date.day.to_s) | |
find('select[name*="1i"]').select(date.year.to_s) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment