Fix mock using throw instead of raise

This commit is contained in:
Thor77 2019-06-14 15:45:04 +02:00
parent f08c4693ad
commit ba758c73ff
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ RSpec.describe BetsController, type: :controller do
context 'on service exception' do context 'on service exception' do
it 'returns an error response' do it 'returns an error response' do
msg = 'an error' msg = 'an error'
expect(user_service).to receive(:bet!).and_throw(UserServiceError.new(msg)) expect(user_service).to receive(:bet!).and_raise(UserServiceError, msg)
post :create, params: create_params post :create, params: create_params
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
expect(deserialize_response(response)[:error]).to eq(msg) expect(deserialize_response(response)[:error]).to eq(msg)