Sha256: f83cffa38b3910874790a302c8d55180a9f88ae53fa5106579b92ea0f4bee345

Contents?: true

Size: 855 Bytes

Versions: 2

Compression:

Stored size: 855 Bytes

Contents

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

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

2 entries across 2 versions & 1 rubygems

Version Path
elabs_matchers-2.0.1 lib/elabs_matchers/helpers/select_year_and_month.rb
elabs_matchers-2.0.0 lib/elabs_matchers/helpers/select_year_and_month.rb