RSpec - mocking a class method
Your spec_helper.rb
should have something like this:
Spec::Runner.configure do |config| # == Mock Framework # # RSpec uses its own mocking framework by default. If you prefer to # use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rrend
The default argument is config.mock_with :rspec
which enables the should_receive
method. If you're using Mocha, for example, the equivalent is expects
, so make sure you're using the right mocking framework.