By default, Cucumber uses mocha. This note shows to use RSpec stubs and mocks instead.
Put the following into your env.rb
:
require 'spec/stubs/cucumber'
Put the following into your env.rb
:
require 'cucumber/rspec/doubles'
Note: Since Cucumber 4 it is important to require these lines in the env.rb
and not any other file in support/*
to register the hooks after any other After
hook in support/*
. Otherwise your doubles are removed, while other After
steps requires them to still be present, e.g. in Capybara::Lockstep.