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/text_spec.rb
Jo Liss 060fc3a72d RackTest::Node#text now normalizes whitespace like Selenium
Previously Rack::Test's #text method might have returned
"   some  text ", whereas now it returns "some text", just like
Selenium.
2012-01-08 23:16:57 +01:00

24 lines
730 B
Ruby

shared_examples_for "text" do
describe '#text' do
it "should print the text of the page" do
@session.visit('/with_simple_html')
@session.text.should == 'Bar'
end
context "with css as default selector" do
before { Capybara.default_selector = :css }
it "should print the text of the page" do
@session.visit('/with_simple_html')
@session.text.should == 'Bar'
end
after { Capybara.default_selector = :xpath }
end
it "should strip whitespace" do
@session.visit('/with_html')
n = @session.find(:css, '#second')
@session.find(:css, '#second').text.should =~ \
/\ADuis aute .* text with whitespace .* est laborum\.\z/
end
end
end