After dobeginChallenge.unstub(:current)rescue RSpec::Mocks::MockExpectationErrorendend
DEPRECATION: Using unstub from rspec-mocks' old :should syntax without explicitly enabling the syntax is deprecated. Use allow(...).to_receive(...).and_call_original or explicitly enable :should instead. Called from /Users/grant/xx/features/support/hooks.rb:37:in block in <top (required)>.
allow(Challenge).to receive(:current).and_call_original
undefined method allow for #<Cucumber::Rails::World:0x007facbed9f1d0> (NoMethodError)
If allow is not defined, it means that RSpec::Mocks::ExampleMethods hasn’t been included in that context. I believe the fix would be:
World(RSpec::Mocks::ExampleMethods)
…but I haven’t written a cucumber hook in a long time.
One general question: why are you trying to unstub a method in an After hook? The lifecycle used by rspec-mocks is per example (i.e. per scenario in a cucumber context), assuming you’ve set it up correctly, so all stubs will be removed after each scenario anyway.
HTH,
Myron
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/1dbbcdc2-d996-4d8a-b03f-5a8f6b1073a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.