Sha256: 073d2039dbbf9c4b1a7db9fc605e4fda1571e00d7f1a6c4ed61b7c0f4c3eec1f

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

shared_examples_for "click_link_or_button" do
  describe '#click' do
    it "should click on a link" do
      @session.visit('/with_html')
      @session.click_link_or_button('labore')
      @session.body.should include('Bar')
    end

    it "should click on a button" do
      @session.visit('/form')
      @session.click_link_or_button('awe123')
      extract_results(@session)['first_name'].should == 'John'
    end

    it "should click on a button with no type attribute" do
      @session.visit('/form')
      @session.click_link_or_button('no_type')
      extract_results(@session)['first_name'].should == 'John'
    end

    it "should be aliased as click for backward compatibility" do
      Capybara.should_receive(:deprecate).with("click", "click_link_or_button")
      @session.visit('/form')
      @session.click('awe123')
      extract_results(@session)['first_name'].should == 'John'
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-0.4.0 lib/capybara/spec/session/click_link_or_button_spec.rb
capybara-0.4.0.rc lib/capybara/spec/session/click_link_or_button_spec.rb