Flowdock
method

mock_with

Importance_2
RSpec latest stable (1.3.1) - 0 notes - Class: Spec::Example::Configuration

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (1.1.4) is shown here.

These similar methods exist in 1.3.1:

mock_with(mock_framework) public

Chooses what mock framework to use. Example:

  Spec::Runner.configure do |config|
    config.mock_with :rspec, :mocha, :flexmock, or :rr
  end

To use any other mock framework, you’ll have to provide your own adapter. This is simply a module that responds to the following methods:

  setup_mocks_for_rspec
  verify_mocks_for_rspec
  teardown_mocks_for_rspec.

These are your hooks into the lifecycle of a given example. RSpec will call setup_mocks_for_rspec before running anything else in each Example. After executing the #after methods, RSpec will then call verify_mocks_for_rspec and teardown_mocks_for_rspec (this is guaranteed to run even if there are failures in verify_mocks_for_rspec).

Once you’ve defined this module, you can pass that to mock_with:

  Spec::Runner.configure do |config|
    config.mock_with MyMockFrameworkAdapter
  end
Show source
Register or log in to add new notes.