Skip to content

Instantly share code, notes, and snippets.

@lbspen
lbspen / gist:5674563
Created May 29, 2013 23:11
Select date and time for capybara-rspec from rails forms
def select_date(date, options = {})
field = options[:from]
base_id = find(:xpath, ".//label[contains(.,'#{field}')]")[:for]
year, month, day = date.split(',')
select year, :from => "#{base_id}_1i"
select month, :from => "#{base_id}_2i"
select day, :from => "#{base_id}_3i"
end
def select_time(hour, minute, options = {})