Sha256: 27d94e582dbc61eaa45dccf8d03d8af017a64d2ef5022c69be4b9bba7de3e6ba

Contents?: true

Size: 826 Bytes

Versions: 5

Compression:

Stored size: 826 Bytes

Contents

module ElabsMatchers
  module Helpers
    module SelectYearAndMonth
      rspec :type => :request
      rspec :type => :feature

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

5 entries across 5 versions & 1 rubygems

Version Path
elabs_matchers-1.0.1 lib/elabs_matchers/helpers/select_year_and_month.rb
elabs_matchers-1.0.0 lib/elabs_matchers/helpers/select_year_and_month.rb
elabs_matchers-0.0.7 lib/elabs_matchers/helpers/select_year_and_month.rb
elabs_matchers-0.0.6 lib/elabs_matchers/helpers/select_year_and_month.rb
elabs_matchers-0.0.5 lib/elabs_matchers/helpers/select_year_and_month.rb