Mocking and Stubbing with Cucumber
# features/support/env_ext.rb or env.rb
require 'cucumber/rspec/doubles'
# login_steps.rb
When(/^the client requests POST "(.*?)" with details:$/) do |path, table|
params = table.rows_hash
allow_any_instance_of(User).to receive(:auth_token).and_return("jwt_token")
post path, login: { account: params["account"], password: params["password"]}
end