Files
grecia/spec/support/matchers/be_rendered.rb
Javi Martín a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00

27 lines
790 B
Ruby

RSpec::Matchers.define :be_rendered do |with: nil|
match do |page|
if with.nil?
!page.native.inner_html.empty?
else
page.has_css?("body") && page.find("body").native.inner_html == with
end
end
failure_message do |page|
if page.has_css?("body")
"expected page to be rendered with #{with}, " \
"but was rendered with #{page.find("body").native.inner_html}"
else
"expected page to be rendered with #{with}, but was not rendered"
end
end
failure_message_when_negated do |page|
if page.has_css?("body")
"expected page not to be rendered, but was rendered with #{page.find("body").native.inner_html}"
else
"expected page not to be rendered, but was rendered with #{page.native.inner_html}"
end
end
end