Make component tests fail when using within

This way we avoid writing useless tests which always pass.
This commit is contained in:
Javi Martín
2021-10-17 16:29:43 +02:00
parent 7154228fbb
commit 174f765074

View File

@@ -18,6 +18,10 @@ module ViewComponent
def sign_in(user) def sign_in(user)
allow(controller).to receive(:current_user).and_return(user) allow(controller).to receive(:current_user).and_return(user)
end end
def within(...)
raise "`within` doesn't work in component tests. Use `page.find` instead."
end
end end
end end