Files
grecia/spec/support/matchers/have_property.rb
2018-10-31 11:51:44 +01:00

16 lines
446 B
Ruby

RSpec::Matchers.define :have_property do |property, with:|
match do
has_css?("meta[property='#{property}'][content='#{with}']", visible: false)
end
failure_message do
meta = first("meta[property='#{property}']", visible: false)
if meta
"expected to find meta tag #{property} with '#{with}', but had '#{meta[:content]}'"
else
"expected to find meta tag #{property} but there were no matches."
end
end
end