Created
September 29, 2010 18:42
-
-
Save jferris/603295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before do | |
Capybara.current_session.driver.rack_mock_session.after_request do | |
body = Capybara.current_session.driver.response.body | |
if match = body.match(%r{<\w+(?:\s+\w+\s*=\s*"[^&]+")*\s*/?>}) | |
puts "WARNING: escaped tag: " + | |
match[0].gsub("<", "<").gsub(">", ">").gsub(""", '"') | |
end | |
if match = body.match(%r{&(\w+);}) | |
puts "WARNING: escaped entity: &#{match[1]};" | |
end | |
end | |
end |
@sdhull I haven't used this in years, but looking at more recent versions of capybara, it doesn't look like Rack::MockSession
is used anymore. I think you could do some monkey-patching on Capybara::RackTest::Browser
to achieve the same thing.
thanks @jferris I'll look into that next time I have some spare time! ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is something we'd like to do at my office. Is there an updated version that will work with rack_test and capybara-webkit?
When I tried this with our test suite, it complains there is no method "rack_mock_session" for the driver.