diff --git a/spec/adapters/signal_adapter/outbound/file_spec.rb b/spec/adapters/signal_adapter/outbound/file_spec.rb index ea8ea06fa..30a829064 100644 --- a/spec/adapters/signal_adapter/outbound/file_spec.rb +++ b/spec/adapters/signal_adapter/outbound/file_spec.rb @@ -24,10 +24,11 @@ end describe 'on error' do - before(:each) { stub_request(:post, 'http://signal:8080/v2/send').to_return(status: 400) } + let(:error_message) { 'User is not registered' } + before(:each) { stub_request(:post, 'http://signal:8080/v2/send').to_return(status: 400, body: { error: error_message }.to_json) } it 'reports the error' do - expect(Sentry).to receive(:capture_exception).with(Net::HTTPClientException) + expect(Sentry).to receive(:capture_exception).with(SignalAdapter::BadRequestError.new(error_code: 400, message: error_message)) subject.call end diff --git a/spec/adapters/signal_adapter/outbound/text_spec.rb b/spec/adapters/signal_adapter/outbound/text_spec.rb index 71bb0625b..1654d2566 100644 --- a/spec/adapters/signal_adapter/outbound/text_spec.rb +++ b/spec/adapters/signal_adapter/outbound/text_spec.rb @@ -24,10 +24,11 @@ end describe 'on error' do - before(:each) { stub_request(:post, 'http://signal:8080/v2/send').to_return(status: 400) } + let(:error_message) { 'User is not registered' } + before(:each) { stub_request(:post, 'http://signal:8080/v2/send').to_return(status: 400, body: { error: error_message }.to_json) } it 'reports the error' do - expect(Sentry).to receive(:capture_exception).with(Net::HTTPClientException) + expect(Sentry).to receive(:capture_exception).with(SignalAdapter::BadRequestError.new(error_code: 400, message: error_message)) subject.call end