endeepak / rspec-multi-mock

Allows multiple mock frameworks to be in action in RSpec (With no monkey patching on Rspec)
https://github.com/endeepak/rspec-multi-mock
MIT License
21 stars 5 forks source link

mocha + rpec-mocks #6

Open BrazhnykYuriy opened 4 years ago

BrazhnykYuriy commented 4 years ago

Unfortunately i can't get this both to work together rspec (3.8.0) rspec-mocks (3.8.1) mocha (1.4.0)

This is the line that is failing:

expect(User).to have_received(:activate!).once

(class)> expected to have received activate!, but that object is not a spy or method has not been stubbed.

I guess this is because RSpec expectations are looking for RSpec mocks instead of Mocha.| Any ideas?

raulcoan commented 3 years ago

@BrazhnykYuriy I had the same issue, have you tried adding this to your config file? config.include Mocha::API Also, the order that you include :mocha and :rspec at the config file appears to matter as well.

BrazhnykYuriy commented 3 years ago

That was a long time ago, we successfully dropped mocha. We used a flag on specs that defined what mocking library to use for each spec(included mocha or rspec-mocks before each spec). And gradually rewritten all specs to rspec-mocks.