1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/spec/dsl/click_spec.rb

26 lines
718 B
Ruby
Raw Normal View History

module ClickSpec
shared_examples_for "click" do
describe '#click' do
it "should click on a link" do
@session.visit('/with_html')
@session.click('labore')
@session.body.should include('Bar')
end
it "should click on a button" do
@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('does not exist')
end.should raise_error(Capybara::ElementNotFound)
end
end
end
end
end