Alternative for object.should_not_receive (: message) in Rspec

Old code for checking receipt in rspec

object.should_receive(:message)

      

According to new rspec syntex we can write this code to check has_recieve

allow(object).to receive(:message)

      

But how can I check something like this

allow(object).to_not receive(:message)

      

we used this path earlier

object.should_not_receive(:message)  # I need a new syntax with latest rspec.

      

I cannot find any document

Thanks in advance.

+3


source to share


1 answer


You can do it this way



expect(object).not_to receive(:message)

      

+3


source







All Articles