Tested module
module Notifications
extend self
def notify(push_id, platform, message, event, args)
puts "hello"
...
end
end
Notifications.should_receive(:notify)
Rspec says that notify wasn’t called, however “hello” is printed to log.
It works fine for me:
Your code is obviously wrong, though, because when you do
#should_receiveit doesn’t invoke the original method. If you can see “hello” being printed out, then it is not getting caught by RSpec. Probably you’re confused about whether you’re stubbing an instance or the module itself.