Merge pull request #613 from jonleighton/fix_specs

Correct the specs for Session#body, #html, #source.
This commit is contained in:
Jo Liss 2012-01-12 09:50:47 -08:00
commit fd3dff5ff5
1 changed files with 13 additions and 11 deletions

View File

@ -88,22 +88,24 @@ shared_examples_for "session with javascript support" do
end end
end end
describe '#body' do describe '#html' do
it "should return the current state of the page" do it "should return the current state of the page" do
@session.visit('/with_js') @session.visit('/with_js')
@session.body.should include('I changed it') @session.html.should include('I changed it')
@session.body.should_not include('This is text') @session.html.should_not include('This is text')
end end
end end
describe '#source' do [:body, :source].each do |method|
it "should return the original, unmodified source of the page" do describe "##{method}" do
# Not supported by Selenium. See for example it "should return the original, unmodified source of the page" do
# http://stackoverflow.com/questions/6050805 # Not supported by Selenium. See for example
unless @session.mode == :selenium # http://stackoverflow.com/questions/6050805
@session.visit('/with_js') unless @session.mode == :selenium
@session.source.should include('This is text') @session.visit('/with_js')
@session.source.should_not include('I changed it') @session.send(method).should include('This is text')
@session.send(method).should_not include('I changed it')
end
end end
end end
end end