Sha256: 6494e8e9f2a09ed1c5c992b9c00751e39758523fe7b50e30b8587a740ffc4289

Contents?: true

Size: 754 Bytes

Versions: 3

Compression:

Stored size: 754 Bytes

Contents

module ElabsMatchers
  module Helpers
    module Capybara
      ##
      #
      # Selects a year and a month on a rails date select input field.
      #
      # @param [String] year      The name of the year used in the select input field
      # @param [String] month     The name of the month used in the select input field
      # @param [Hash] options     The label of the select field
      #
      # Example:
      # select_year_and_month("2010", "March", :from => "Birth date")

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elabs_matchers-0.0.3 lib/elabs_matchers/helpers/capybara.rb
elabs_matchers-0.0.2 lib/elabs_matchers/helpers/capybara.rb
elabs_matchers-0.0.1 lib/elabs_matchers/helpers/capybara.rb