Created
July 7, 2014 07:38
-
-
Save nunogoncalves/0eedbd2ff31d5d5a9c66 to your computer and use it in GitHub Desktop.
Rspec test which is expecting an email to be sent to email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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