Closed simonasdev closed 3 years ago
For now I've settled by implementing synchronize_expectation
in BaseTestHelper
:
class BaseTestHelper < Capybara::TestHelper
def synchronize_expectation(*args)
super
end
end
but this seems really unnecessary
By default, synchronize_expectation
is protected
, because it's meant to be used inside test helpers, where it can be properly encapsulated.
Using it directly in tests can make them significantly harder to read.
If you really need to, you can change the method visibility to public
instead:
class BaseTestHelper < Capybara::TestHelper
public :synchronize_expectation
end
Hi. Just started using your gem but can't really get how can I use
synchronize_expectation
globally in my tests. After defining base test helper like so:and verifying that this class indeed defines
synchronize_expectation
method I've tried using it in my globally included module like so:But when calling
synchronize_expectation
I'm still gettingundefined method synchronize_expectation for #<RSpec::ExampleGroups::Dashboard::NewUser:0x00007f99afaa5cd0>
. Even if I delegate the method to base withdelegate :synchronize_expectation, to: :base
inside ofincluded
block, I'm still gettingprotected method synchronize_expectation called for #<BaseTestHelper 70144865172940>
. So it seems to me thatsynchronize_expectation
can only be called without explicit receiver, hence only inside of subclasses ofCapybara::TestHelper
. Any ideas what I'm missing? The example does not include this use case as far as I've noticed