Module: ElabsMatchers::Helpers::SelectYearAndMonth

Defined in:
lib/elabs_matchers/helpers/select_year_and_month.rb

Instance Method Summary collapse

Instance Method Details

#select_year_and_month(year, month, options = {}) ⇒ Object

Selects a year and a month on a rails date select input field.

Example: select_year_and_month(“2010”, “March”, :from => “Birth date”)

Parameters:

  • year (String)

    The name of the year used in the select input field

  • month (String)

    The name of the month used in the select input field

  • options (Hash) (defaults to: {})

    The label of the select field



19
20
21
22
23
24
25
# File 'lib/elabs_matchers/helpers/select_year_and_month.rb', line 19

def select_year_and_month(year, month, options={})
  year_field = find_field(options[:from])
  month_field = find(:id, year_field[:id].sub(/_1i$/, "_2i"))

  year_field.select(year)
  month_field.select(month)
end