Sha256: 1918197fc947a20d867cc6d06534a7476f69fd889a6cc1f01df25b4c510a9009

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"

describe ElabsMatchers::Helpers::SelectYearAndMonth do
  let(:page) { Capybara::Session.new(:rack_test, proc { |env| [200, {}, [html]]}) }
  let(:html) do
    %Q{
      <label for="post_date_1i">Date</label>
      <select id="post_date_1i" name="post[date(1i)]">
        <option value="2009" selected="selected">2009</option>
        <option value="2010">2010</option>
      </select>
      <select id="post_date_2i" name="post[date(2i)]">
        <option value="1" selected="selected">January</option>
        <option value="2">February</option>
      </select>
    }
  end

  before do
    page.extend(ElabsMatchers::Helpers::SelectYearAndMonth)
    page.visit "/"
  end

  describe "#select_year_and_month" do
    it "selects the year and momth selects" do
      page.select_year_and_month("2010", "February", :from => "Date")

      page.find("#post_date_1i").find("option[selected]").text.should == "2010"
      page.find("#post_date_2i").find("option[selected]").text.should == "February"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
elabs_matchers-2.0.1 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-2.0.0 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-1.0.1 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-1.0.0 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-0.0.7 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-0.0.6 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-0.0.5 spec/elabs_matchers/helpers/select_year_and_month_spec.rb
elabs_matchers-0.0.4 spec/elabs_matchers/helpers/select_year_and_month_spec.rb