Sha256: 9a135e1ae0bf686df04254c5053811d3c8de1526a54c2e34cc43900ef7423825

Contents?: true

Size: 881 Bytes

Versions: 7

Compression:

Stored size: 881 Bytes

Contents

Capybara::SpecHelper.spec '#find_link' do
  before do
    @session.visit('/with_html')
  end

  it "should find any field" do
    @session.find_link('foo').text.should == "ullamco"
    @session.find_link('labore')[:href].should =~ %r(/with_simple_html$)
  end

  it "casts to string" do
    @session.find_link(:'foo').text.should == "ullamco"
  end

  it "should raise error if the field doesn't exist" do
    expect do
      @session.find_link('Does not exist')
    end.to raise_error(Capybara::ElementNotFound)
  end

  context "with :exact option" do
    it "should accept partial matches when false" do
      @session.find_link('abo', :exact => false).text.should == "labore"
    end

    it "should not accept partial matches when true" do
      expect do
        @session.find_link('abo', :exact => true)
      end.to raise_error(Capybara::ElementNotFound)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
capybara-2.2.1 lib/capybara/spec/session/find_link_spec.rb
capybara-2.2.0 lib/capybara/spec/session/find_link_spec.rb
capybara-2.2.0.rc1 lib/capybara/spec/session/find_link_spec.rb
swipe-rails-0.0.5 vendor/bundle/gems/capybara-2.1.0/lib/capybara/spec/session/find_link_spec.rb
capybara-2.1.0 lib/capybara/spec/session/find_link_spec.rb
capybara-2.1.0.rc1 lib/capybara/spec/session/find_link_spec.rb
capybara-2.1.0.beta1 lib/capybara/spec/session/find_link_spec.rb