Sha256: 27ba59d0d03457400fb2145df4637b029ef83fbf77568d13d0e47bebcb7fcf0c

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

module ChooseSpec
  shared_examples_for "choose" do

    describe "#choose" do
      before do
        @session.visit('/form')
      end

      it "should choose a radio button by id" do
        @session.choose("gender_male")
        @session.click_button('awesome')
        extract_results(@session)['gender'].should == 'male'
      end

      it "should choose a radio button by label" do
        @session.choose("Both")
        @session.click_button('awesome')
        extract_results(@session)['gender'].should == 'both'
      end

      context "with a locator that doesn't exist" do
        it "should raise an error" do
          running { @session.choose('does not exist') }.should raise_error(Capybara::ElementNotFound)
        end
      end
    end
  end
end  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-0.3.0 spec/dsl/choose_spec.rb