Hm, I was not aware of that.  In that case, I guess it should be deleted 
altogether.  I'll try that out.  Thanks for the heads-up.



On Monday, July 27, 2015 at 11:46:52 AM UTC-5, Myron Marston wrote:
>
> 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
> ​
>
> On Mon, Jul 27, 2015 at 8:51 AM, Grant Birchmeier <[email protected] 
> <javascript:>> wrote:
>
>> In my cucumber hooks file, I had this code under RSpec 2:
>>
>> After do
>>   begin
>>     Challenge.unstub(:current)
>>   rescue RSpec::Mocks::MockExpectationError
>>   end
>> end
>>
>>
>> After upgrading to RSpec 3, I get a deprecation warning:
>>
>> 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)>.
>>
>>
>> So I followed that, changing the offending line instead to:
>>
>> allow(Challenge).to receive(:current).and_call_original
>>
>>
>> But now I get:
>>
>> undefined method allow for #<Cucumber::Rails::World:0x007facbed9f1d0> 
>> (NoMethodError)
>>
>>
>> I've tried adding "include RSpec::Matchers" a few different ways, but it 
>> doesn't change anything.
>>
>> I'm kind of stuck.  Can anyone show me the way?
>>
>> -Grant 
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/rspec/1dbbcdc2-d996-4d8a-b03f-5a8f6b1073a4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rspec/1dbbcdc2-d996-4d8a-b03f-5a8f6b1073a4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/a74d51d3-7813-4b15-b68a-5b14aca7a525%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to