Define and apply matcher :be_rendered

Add this changes to make components specs clear
This commit is contained in:
taitus
2021-11-03 18:17:30 +01:00
parent 2b35144540
commit 612872ac7a
20 changed files with 41 additions and 28 deletions

View File

@@ -0,0 +1,13 @@
RSpec::Matchers.define :be_rendered do
match do |page|
!page.native.inner_html.empty?
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