Cucumber::Rails::Capybara::SelectDatesAndTimes

Public Instance Methods

select_date(field, options = {}) click to toggle source
# File lib/cucumber/rails/capybara/select_dates_and_times.rb, line 5
def select_date(field, options = {})
  date        = Date.parse(options[:with])
  base_dom_id = get_base_dom_id_from_label_tag(field)

  find(:xpath, "//select[@id='#{base_dom_id}_1i']").select(date.year.to_s)
  find(:xpath, "//select[@id='#{base_dom_id}_2i']").select(I18n.l date, :format => '%B')
  find(:xpath, "//select[@id='#{base_dom_id}_3i']").select(date.day.to_s)
end
select_datetime(field, options = {}) click to toggle source
# File lib/cucumber/rails/capybara/select_dates_and_times.rb, line 22
def select_datetime(field, options = {})
  select_date(field, options)
  select_time(field, options)
end
select_time(field, options = {}) click to toggle source
# File lib/cucumber/rails/capybara/select_dates_and_times.rb, line 14
def select_time(field, options = {})
  time        = Time.zone.parse(options[:with])
  base_dom_id = get_base_dom_id_from_label_tag(field)

  find(:xpath, "//select[@id='#{base_dom_id}_4i']").select(time.hour.to_s.rjust(2, '0'))
  find(:xpath, "//select[@id='#{base_dom_id}_5i']").select(time.min.to_s.rjust(2,  '0'))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.