Last active
December 26, 2015 12:39
-
-
Save rgarner/7152901 to your computer and use it in GitHub Desktop.
Match SVG text (polyfill for broken Poltergeist)
This file contains 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
RSpec::Matchers.define :have_svg_text do |text| | |
match do |page| | |
doc = Nokogiri::HTML(page.body) | |
doc.at_xpath("//text[text()='#{text}']") | |
end | |
failure_message_for_should do |actual| | |
"expected #{actual} to have SVG text #{text}, was not found" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment