Fix WebHookService spec failing in Ruby 2.6

Ruby 2.6 changed Net::ReadTimeout#message to include the reason for the
socket error (https://bugs.ruby-lang.org/issues/14832). However,
WebHookService was failing in Ruby 2.6 because it expected
Exception#message to match Exception#to_s, which isn't always the
case. Fix this by just checking Exception#to_s.
This commit is contained in:
Stan Hu 2019-02-16 14:36:04 -08:00
parent 28aa4d331c
commit c220f30081

View file

@ -102,7 +102,7 @@ describe WebHookService do
exception = exception_class.new('Exception message')
WebMock.stub_request(:post, project_hook.url).to_raise(exception)
expect(service_instance.execute).to eq({ status: :error, message: exception.message })
expect(service_instance.execute).to eq({ status: :error, message: exception.to_s })
expect { service_instance.execute }.not_to raise_error
end
end