Skip to content

Instantly share code, notes, and snippets.

@nunogoncalves
Created July 7, 2014 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nunogoncalves/0eedbd2ff31d5d5a9c66 to your computer and use it in GitHub Desktop.
Save nunogoncalves/0eedbd2ff31d5d5a9c66 to your computer and use it in GitHub Desktop.
Rspec test which is expecting an email to be sent to email
it 'sends email to admin with error response' do
VCR.use_cassette('external_service_response_cassette/invalid_requests', record: :new_episodes) do
Hash.any_instance.stub(:value_from_params).and_raise(ExceptionType, "Failed to find key in params")
params1 = 'AdminMailer'
params2 = 'errors'
params3 = 'Error message: There has been an error'
SendEmailWorker.should_receive(:perform_async).with(params1, params2, params3).exactly(1).times
get :request_external_service, { parameters }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment