Sha256: beca0a8d78e623196fd7c1c11ba0c4a76817c7b3c93ef1a7866ae402c6314844

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

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

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

1 entries across 1 versions & 1 rubygems

Version Path
elabs_matchers-0.0.4 lib/elabs_matchers/helpers/select_year_and_month.rb