1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/spec/session/body_spec.rb
Jonas Nicklas 268b7caf32 Use have_content over body.should include, closes #792
The latter has timing issues in Selenium, since
visit/click_link, etc are async even on regular
page reloads.
2012-08-30 15:59:43 +02:00

21 lines
723 B
Ruby

Capybara::SpecHelper.spec '#body' do
it "should return the unmodified page body" do
@session.visit('/')
@session.should have_content('Hello world!') # wait for content to appear if visit is async
@session.body.should include('Hello world!')
end
if "".respond_to?(:encoding)
context "encoding of response between ascii and utf8" do
it "should be valid with html entities" do
@session.visit('/with_html_entities')
lambda { @session.body.encode!("UTF-8") }.should_not raise_error
end
it "should be valid without html entities" do
@session.visit('/with_html')
lambda { @session.body.encode!("UTF-8") }.should_not raise_error
end
end
end
end