Sha256: 9944c71395c91b2e7c247d769d191e4aaf00847a1c67f8d944e1dfed7dfa1a44

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

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
        msg = "Unable to find radio button \"does not exist\""
        running do
          @session.choose('does not exist')
        end.should raise_error(Capybara::ElementNotFound, msg)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-2.0.0.beta2 lib/capybara/spec/session/choose_spec.rb