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
Jonas Nicklas 49cfacba1f Differentiate between source and body
source returns the unmodified page source
body returns the current dom html
2010-01-01 23:58:59 +01:00

26 lines
No EOL
718 B
Ruby

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