Sha256: 9f3c908f8eef3d6a631519aefcc0c744430dc4f8c913489a0c72148372cc9e8d

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

Capybara::SpecHelper.spec '#has_button?' do
  before do
    @session.visit('/form')
  end

  it "should be true if the given button is on the page" do
    @session.should have_button('med')
    @session.should have_button('crap321')
    @session.should have_button(:'crap321')
  end

  it "should be true for disabled buttons if :disabled => true" do
    @session.should have_button('Disabled button', :disabled => true)
  end

  it "should be false if the given button is not on the page" do
    @session.should_not have_button('monkey')
  end

  it "should be false for disabled buttons by default" do
    @session.should_not have_button('Disabled button')
  end

  it "should be false for disabled buttons if :disabled => false" do
    @session.should_not have_button('Disabled button', :disabled => false)
  end
end

Capybara::SpecHelper.spec '#has_no_button?' do
  before do
    @session.visit('/form')
  end

  it "should be true if the given button is on the page" do
    @session.should_not have_no_button('med')
    @session.should_not have_no_button('crap321')
  end

  it "should be true for disabled buttons if :disabled => true" do
    @session.should_not have_no_button('Disabled button', :disabled => true)
  end

  it "should be false if the given button is not on the page" do
    @session.should have_no_button('monkey')
  end

  it "should be false for disabled buttons by default" do
    @session.should have_no_button('Disabled button')
  end

  it "should be false for disabled buttons if :disabled => false" do
    @session.should have_no_button('Disabled button', :disabled => false)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capybara-2.2.1 lib/capybara/spec/session/has_button_spec.rb
capybara-2.2.0 lib/capybara/spec/session/has_button_spec.rb
capybara-2.2.0.rc1 lib/capybara/spec/session/has_button_spec.rb