From c220f300815bc9dbfe69debcbd8331fa193eeb9f Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 16 Feb 2019 14:36:04 -0800 Subject: [PATCH] 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. --- spec/services/web_hook_service_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb index 5945a7dc0ad..747e04fb18c 100644 --- a/spec/services/web_hook_service_spec.rb +++ b/spec/services/web_hook_service_spec.rb @@ -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