webmock 3.0.1 → 3.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/CI.yml +38 -0
  3. data/CHANGELOG.md +496 -2
  4. data/Gemfile +1 -1
  5. data/README.md +169 -34
  6. data/Rakefile +12 -4
  7. data/lib/webmock/api.rb +12 -0
  8. data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +221 -0
  9. data/lib/webmock/http_lib_adapters/curb_adapter.rb +19 -5
  10. data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +7 -4
  11. data/lib/webmock/http_lib_adapters/excon_adapter.rb +5 -2
  12. data/lib/webmock/http_lib_adapters/http_rb/client.rb +2 -1
  13. data/lib/webmock/http_lib_adapters/http_rb/request.rb +7 -1
  14. data/lib/webmock/http_lib_adapters/http_rb/response.rb +27 -3
  15. data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +9 -3
  16. data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +7 -3
  17. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +28 -9
  18. data/lib/webmock/http_lib_adapters/manticore_adapter.rb +33 -15
  19. data/lib/webmock/http_lib_adapters/net_http.rb +36 -89
  20. data/lib/webmock/http_lib_adapters/net_http_response.rb +1 -1
  21. data/lib/webmock/http_lib_adapters/patron_adapter.rb +4 -4
  22. data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  23. data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  24. data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  25. data/lib/webmock/matchers/hash_including_matcher.rb +4 -23
  26. data/lib/webmock/rack_response.rb +1 -1
  27. data/lib/webmock/request_body_diff.rb +1 -1
  28. data/lib/webmock/request_execution_verifier.rb +2 -3
  29. data/lib/webmock/request_pattern.rb +129 -51
  30. data/lib/webmock/request_registry.rb +1 -1
  31. data/lib/webmock/request_signature.rb +3 -3
  32. data/lib/webmock/request_signature_snippet.rb +4 -4
  33. data/lib/webmock/request_stub.rb +15 -0
  34. data/lib/webmock/response.rb +19 -13
  35. data/lib/webmock/rspec.rb +10 -3
  36. data/lib/webmock/stub_registry.rb +26 -11
  37. data/lib/webmock/stub_request_snippet.rb +10 -6
  38. data/lib/webmock/test_unit.rb +1 -3
  39. data/lib/webmock/util/hash_counter.rb +3 -3
  40. data/lib/webmock/util/headers.rb +17 -2
  41. data/lib/webmock/util/json.rb +1 -2
  42. data/lib/webmock/util/query_mapper.rb +9 -7
  43. data/lib/webmock/util/uri.rb +10 -10
  44. data/lib/webmock/util/values_stringifier.rb +20 -0
  45. data/lib/webmock/version.rb +1 -1
  46. data/lib/webmock/webmock.rb +20 -3
  47. data/lib/webmock.rb +53 -48
  48. data/minitest/webmock_spec.rb +3 -3
  49. data/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  50. data/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
  51. data/spec/acceptance/curb/curb_spec.rb +44 -0
  52. data/spec/acceptance/em_http_request/em_http_request_spec.rb +57 -1
  53. data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +2 -2
  54. data/spec/acceptance/excon/excon_spec.rb +4 -2
  55. data/spec/acceptance/excon/excon_spec_helper.rb +2 -0
  56. data/spec/acceptance/http_rb/http_rb_spec.rb +20 -0
  57. data/spec/acceptance/http_rb/http_rb_spec_helper.rb +5 -2
  58. data/spec/acceptance/httpclient/httpclient_spec.rb +8 -1
  59. data/spec/acceptance/manticore/manticore_spec.rb +51 -0
  60. data/spec/acceptance/net_http/net_http_shared.rb +47 -10
  61. data/spec/acceptance/net_http/net_http_spec.rb +102 -24
  62. data/spec/acceptance/net_http/real_net_http_spec.rb +1 -1
  63. data/spec/acceptance/patron/patron_spec.rb +26 -21
  64. data/spec/acceptance/patron/patron_spec_helper.rb +3 -3
  65. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +14 -14
  66. data/spec/acceptance/shared/callbacks.rb +3 -2
  67. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +1 -1
  68. data/spec/acceptance/shared/request_expectations.rb +14 -0
  69. data/spec/acceptance/shared/returning_declared_responses.rb +36 -15
  70. data/spec/acceptance/shared/stubbing_requests.rb +95 -0
  71. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +1 -1
  72. data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +1 -1
  73. data/spec/support/webmock_server.rb +1 -0
  74. data/spec/unit/api_spec.rb +103 -3
  75. data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  76. data/spec/unit/request_execution_verifier_spec.rb +12 -12
  77. data/spec/unit/request_pattern_spec.rb +207 -49
  78. data/spec/unit/request_signature_snippet_spec.rb +2 -2
  79. data/spec/unit/request_signature_spec.rb +21 -1
  80. data/spec/unit/request_stub_spec.rb +35 -0
  81. data/spec/unit/response_spec.rb +51 -19
  82. data/spec/unit/stub_request_snippet_spec.rb +30 -10
  83. data/spec/unit/util/query_mapper_spec.rb +13 -0
  84. data/spec/unit/util/uri_spec.rb +74 -2
  85. data/spec/unit/webmock_spec.rb +108 -5
  86. data/test/shared_test.rb +15 -2
  87. data/test/test_webmock.rb +6 -0
  88. data/webmock.gemspec +15 -7
  89. metadata +86 -37
  90. data/.travis.yml +0 -20
@@ -63,6 +63,16 @@ shared_examples_for "stubbing requests" do |*adapter_info|
63
63
  stub_request(:get, "www.example.com").with(query: hash_including({"a" => ["b", "c"]})).to_return(body: "abc")
64
64
  expect(http_request(:get, "http://www.example.com/?a[]=b&a[]=c&b=1").body).to eq("abc")
65
65
  end
66
+
67
+ it 'should return stubbed response when stub expects exclude part of query params' do
68
+ stub_request(:get, 'www.example.com').with(query: hash_excluding(a: ['b', 'c'])).to_return(body: 'abc')
69
+ expect(http_request(:get, 'http://www.example.com/?a[]=c&a[]=d&b=1').body).to eq('abc')
70
+ end
71
+
72
+ it "should return stubbed response when stub expects an empty array" do
73
+ stub_request(:get, 'www.example.com').with(query: { a: [] }).to_return(body: 'abc')
74
+ expect(http_request(:get, 'http://www.example.com/?a[]').body).to eq('abc')
75
+ end
66
76
  end
67
77
 
68
78
  describe "based on method" do
@@ -150,6 +160,32 @@ shared_examples_for "stubbing requests" do |*adapter_info|
150
160
  body: 'c[d][]=f&a=1&c[d][]=e')
151
161
  }.to raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: POST http://www.example.com/ with body 'c\[d\]\[\]=f&a=1&c\[d\]\[\]=e'))
152
162
  end
163
+
164
+ describe "for request with form url encoded body and content type" do
165
+ it "should match if stubbed request body hash has string values matching string values in request body" do
166
+ WebMock.reset!
167
+ stub_request(:post, "www.example.com").with(body: {"foo" => '1'})
168
+ expect(http_request(
169
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/x-www-form-urlencoded'},
170
+ body: "foo=1").status).to eq("200")
171
+ end
172
+
173
+ it "should match if stubbed request body hash has NON string values matching string values in request body" do
174
+ WebMock.reset!
175
+ stub_request(:post, "www.example.com").with(body: {"foo" => 1})
176
+ expect(http_request(
177
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/x-www-form-urlencoded'},
178
+ body: "foo=1").status).to eq("200")
179
+ end
180
+
181
+ it "should match if stubbed request body is hash_included" do
182
+ WebMock.reset!
183
+ stub_request(:post, "www.example.com").with(body: {"foo" => hash_including("bar" => '1')})
184
+ expect(http_request(
185
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/x-www-form-urlencoded'},
186
+ body: "foo[bar]=1").status).to eq("200")
187
+ end
188
+ end
153
189
  end
154
190
 
155
191
 
@@ -182,6 +218,30 @@ shared_examples_for "stubbing requests" do |*adapter_info|
182
218
  :post, "http://www.example.com/", headers: {'Content-Type' => 'application/json'},
183
219
  body: "{\"foo\":\"a b c\"}").status).to eq("200")
184
220
  end
221
+
222
+ it "should match if stubbed request body hash has NON string values matching NON string values in request body" do
223
+ WebMock.reset!
224
+ stub_request(:post, "www.example.com").with(body: {"foo" => 1})
225
+ expect(http_request(
226
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/json'},
227
+ body: "{\"foo\":1}").status).to eq("200")
228
+ end
229
+
230
+ it "should not match if stubbed request body hash has string values matching NON string values in request body" do
231
+ WebMock.reset!
232
+ stub_request(:post, "www.example.com").with(body: {"foo" => '1'})
233
+ expect{http_request(
234
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/json'},
235
+ body: "{\"foo\":1}") }.to raise_error(WebMock::NetConnectNotAllowedError)
236
+ end
237
+
238
+ it "should not match if stubbed request body hash has NON string values matching string values in request body" do
239
+ WebMock.reset!
240
+ stub_request(:post, "www.example.com").with(body: {"foo" => 1})
241
+ expect{http_request(
242
+ :post, "http://www.example.com/", headers: {'Content-Type' => 'application/json'},
243
+ body: "{\"foo\":\"1\"}") }.to raise_error(WebMock::NetConnectNotAllowedError)
244
+ end
185
245
  end
186
246
 
187
247
  describe "for request with xml body and content type is set to xml" do
@@ -533,6 +593,23 @@ shared_examples_for "stubbing requests" do |*adapter_info|
533
593
  end
534
594
  end
535
595
  end
596
+
597
+ context "when global stub should be invoked last" do
598
+ before do
599
+ WebMock.globally_stub_request(:after_local_stubs) do
600
+ { body: "global stub body" }
601
+ end
602
+ end
603
+
604
+ it "uses global stub when non-global stub is not defined" do
605
+ expect(http_request(:get, "http://www.example.com/").body).to eq("global stub body")
606
+ end
607
+
608
+ it "uses non-global stub first" do
609
+ stub_request(:get, "www.example.com").to_return(body: 'non-global stub body')
610
+ expect(http_request(:get, "http://www.example.com/").body).to eq("non-global stub body")
611
+ end
612
+ end
536
613
  end
537
614
 
538
615
  describe "when stubbing request with a block evaluated on request" do
@@ -580,4 +657,22 @@ shared_examples_for "stubbing requests" do |*adapter_info|
580
657
  }.to raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
581
658
  end
582
659
  end
660
+
661
+ describe "in Rspec around(:each) hook" do
662
+ # order goes
663
+ # around(:each)
664
+ # before(:each)
665
+ # after(:each)
666
+ # anything after example.run in around(:each)
667
+ around(:each) do |example|
668
+ example.run
669
+ expect {
670
+ http_request(:get, "http://www.example.com/")
671
+ }.to_not raise_error # WebMock::NetConnectNotAllowedError
672
+ end
673
+
674
+ it "should still allow me to make a mocked request" do
675
+ stub_request(:get, "www.example.com")
676
+ end
677
+ end
583
678
  end
@@ -127,7 +127,7 @@ unless RUBY_PLATFORM =~ /java/
127
127
  end
128
128
  hydra.queue @request
129
129
  hydra.run
130
- expect(test_headers).to include('X-Test' => '1')
130
+ expect(test_headers.to_h).to include('X-Test' => '1')
131
131
  end
132
132
  end
133
133
  end
@@ -6,7 +6,7 @@ module TyphoeusHydraSpecHelper
6
6
 
7
7
 
8
8
  def http_request(method, uri, options = {}, &block)
9
- uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
9
+ uri = uri.gsub(" ", "%20") #typhoeus doesn't like spaces in the uri
10
10
  request_options = {
11
11
  method: method,
12
12
  body: options[:body],
@@ -36,6 +36,7 @@ class WebMockServer
36
36
  end
37
37
  end
38
38
  server.start do |socket|
39
+ socket.read(1)
39
40
  socket.puts <<-EOT.gsub(/^\s+\|/, '')
40
41
  |HTTP/1.1 200 OK\r
41
42
  |Date: Fri, 31 Dec 1999 23:59:59 GMT\r
@@ -2,9 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe WebMock::API do
4
4
  describe '#hash_including' do
5
-
6
5
  subject { klass.new.hash_including(args) }
7
- let(:args) { {data: :one} }
6
+ let(:args) { { data: :one } }
8
7
 
9
8
  context 'when mixed into a class that does not define `hash_including`' do
10
9
  let(:klass) do
@@ -54,7 +53,7 @@ describe WebMock::API do
54
53
 
55
54
 
56
55
  context 'when mixed into a class with a parent that defines `hash_including`' do
57
- subject {klass.new.hash_including(*args)}
56
+ subject { klass.new.hash_including(*args) }
58
57
  let(:args) { %w(:foo, :bar, {:data => :one}) }
59
58
  let(:klass) do
60
59
  Class.new(
@@ -70,6 +69,107 @@ describe WebMock::API do
70
69
  expect(subject).to eq(args)
71
70
  end
72
71
  end
72
+ end
73
+
74
+ describe '#hash_excluding' do
75
+ subject { klass.new.hash_excluding(args) }
76
+ let(:args) { { data: :one } }
77
+
78
+ context 'when mixed into a class that does not define `hash_including`' do
79
+ let(:klass) do
80
+ Class.new do
81
+ include WebMock::API
82
+ end
83
+ end
84
+
85
+ it 'uses WebMock::Matchers::HashIncludingMatcher' do
86
+ expect(subject).to be_a(WebMock::Matchers::HashExcludingMatcher)
87
+ end
88
+
89
+ # by testing equality for HashIncludingMatcher (which stringifies the passed hash) we are
90
+ # testing HashIncludingMatcher.initialize behavior as well
91
+ context 'when args correspond to an hash' do
92
+ context 'creates "HashExcludingMatcher"' do
93
+ it 'equals hash with similar key but different value' do
94
+ expect(subject).to eq('data' => :two)
95
+ end
96
+
97
+ it 'equals hash with similar value but different key' do
98
+ expect(subject).to eq('data2' => :one)
99
+ end
100
+
101
+ it 'equals hash with defferent value and key' do
102
+ expect(subject).to eq('data2' => :two)
103
+ end
104
+
105
+ it 'not equals with similar value and key' do
106
+ expect(subject).not_to eq('data' => :one)
107
+ end
108
+ end
109
+ end
110
+
111
+ context 'when args are one or many keys' do
112
+ subject { klass.new.hash_excluding(:foo, :bar) }
113
+ let(:anything) { WebMock::Matchers::AnyArgMatcher.new(nil) }
114
+
115
+ it "creates 'HashExcludingMatcher' with keys anythingized" do
116
+ expect(subject).not_to eq('foo' => anything, 'bar' => anything )
117
+ end
118
+ end
119
+
120
+ context 'when args are both keys and key/value pairs' do
121
+ subject { klass.new.hash_excluding(:foo, :bar, data: :one) }
122
+ let(:anything) { WebMock::Matchers::AnyArgMatcher.new(nil) }
123
+
124
+ it 'creates "HashExcludingMatcher" with keys anythingized' do
125
+ expect(subject).not_to eq('foo' => anything, 'bar' => anything, 'data' => :one)
126
+ end
127
+ end
128
+
129
+ context 'when args are an empty hash' do
130
+ subject { klass.new.hash_excluding({}) }
131
+
132
+ it 'creates "HashExcludingMatcher" with an empty hash' do
133
+ expect(subject).to eq({})
134
+ end
135
+ end
136
+ end
137
+
138
+ context 'when mixed into a class with a parent that defines `hash_excluding`' do
139
+ subject { klass.new.hash_excluding(*args) }
140
+ let(:args) { %w(:foo, :bar, {:data => :one}) }
141
+ let(:klass) do
142
+ Class.new(
143
+ Class.new do
144
+ def hash_excluding(*args)
145
+ args
146
+ end
147
+ end
148
+ ) { include WebMock::API }
149
+ end
150
+
151
+ it 'uses super and passes the args untampered' do
152
+ expect(subject).to eq(args)
153
+ end
154
+ end
155
+ end
156
+
157
+ describe '#reset_executed_requests!' do
158
+ subject { WebMock::API.reset_executed_requests! }
159
+
160
+ let(:request_signature) { WebMock::RequestSignature.new(:get, "www.example.com") }
161
+ let(:request_pattern) { WebMock::RequestPattern.new(:get, "www.example.com") }
73
162
 
163
+ before do
164
+ WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
165
+ end
166
+
167
+ it 'resets request registry counter' do
168
+ expect{
169
+ subject
170
+ }.to change{
171
+ WebMock::RequestRegistry.instance.times_executed(request_pattern)
172
+ }.from(1).to(0)
173
+ end
74
174
  end
75
175
  end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ module WebMock
4
+ module Matchers
5
+ describe HashExcludingMatcher do
6
+ it 'stringifies the given hash keys' do
7
+ expect(HashExcludingMatcher.new(a: 1, b: 2)).not_to eq('a' => 1, 'b' => 2)
8
+ end
9
+
10
+ it 'sorts elements in the hash' do
11
+ expect(HashExcludingMatcher.new(b: 2, a: 1)).not_to eq('a' => 1, 'b' => 2)
12
+ end
13
+
14
+ it 'describes itself properly' do
15
+ expect(HashExcludingMatcher.new(a: 1).inspect).to eq 'hash_excluding({"a"=>1})'
16
+ end
17
+
18
+ describe 'success' do
19
+ it 'match with hash with a missing key' do
20
+ expect(HashExcludingMatcher.new(a: 1)).to eq('b' => 2)
21
+ end
22
+
23
+ it 'match an empty hash with a given key' do
24
+ expect(HashExcludingMatcher.new(a: 1)).to eq({})
25
+ end
26
+
27
+ it 'match when values are nil but keys are different' do
28
+ expect(HashExcludingMatcher.new(a: nil)).to eq('b' => nil)
29
+ end
30
+
31
+ describe 'when matching an empty hash' do
32
+ it 'does not matches against any hash' do
33
+ expect(HashExcludingMatcher.new({})).to eq(a: 1, b: 2, c: 3)
34
+ end
35
+ end
36
+ end
37
+
38
+ describe 'failing' do
39
+ it 'does not match a hash with a one missing key when one pair is matching' do
40
+ expect(HashExcludingMatcher.new(a: 1, b: 2)).not_to eq('b' => 2)
41
+ end
42
+
43
+ it 'match a hash with an incorrect value' do
44
+ expect(HashExcludingMatcher.new(a: 1, b: 2)).not_to eq('a' => 1, 'b' => 3)
45
+ end
46
+
47
+ it 'does not matches the same hash' do
48
+ expect(HashExcludingMatcher.new('a' => 1, 'b' => 2)).not_to eq('a' => 1, 'b' => 2)
49
+ end
50
+
51
+ it 'does not matches a hash with extra stuff' do
52
+ expect(HashExcludingMatcher.new(a: 1)).not_to eq('a' => 1, 'b' => 2)
53
+ end
54
+
55
+ it 'does not match a non-hash' do
56
+ expect(HashExcludingMatcher.new(a: 1)).not_to eq 1
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -53,7 +53,7 @@ describe WebMock::RequestExecutionVerifier do
53
53
  @verifier.times_executed = 0
54
54
  @verifier.expected_times_executed = 2
55
55
  expected_text = "The request www.example.com was expected to execute 2 times but it executed 0 times"
56
- expected_text << @executed_requests_info
56
+ expected_text += @executed_requests_info
57
57
  expect(@verifier.failure_message).to eq(expected_text)
58
58
  end
59
59
 
@@ -61,7 +61,7 @@ describe WebMock::RequestExecutionVerifier do
61
61
  @verifier.times_executed = 1
62
62
  @verifier.expected_times_executed = 1
63
63
  expected_text = "The request www.example.com was expected to execute 1 time but it executed 1 time"
64
- expected_text << @executed_requests_info
64
+ expected_text += @executed_requests_info
65
65
  expect(@verifier.failure_message).to eq(expected_text)
66
66
  end
67
67
 
@@ -70,7 +70,7 @@ describe WebMock::RequestExecutionVerifier do
70
70
  @verifier.times_executed = 1
71
71
  @verifier.at_least_times_executed = 2
72
72
  expected_text = "The request www.example.com was expected to execute at least 2 times but it executed 1 time"
73
- expected_text << @executed_requests_info
73
+ expected_text += @executed_requests_info
74
74
  expect(@verifier.failure_message).to eq(expected_text)
75
75
  end
76
76
 
@@ -78,7 +78,7 @@ describe WebMock::RequestExecutionVerifier do
78
78
  @verifier.times_executed = 2
79
79
  @verifier.at_least_times_executed = 3
80
80
  expected_text = "The request www.example.com was expected to execute at least 3 times but it executed 2 times"
81
- expected_text << @executed_requests_info
81
+ expected_text += @executed_requests_info
82
82
  expect(@verifier.failure_message).to eq(expected_text)
83
83
  end
84
84
  end
@@ -88,7 +88,7 @@ describe WebMock::RequestExecutionVerifier do
88
88
  @verifier.times_executed = 3
89
89
  @verifier.at_most_times_executed = 2
90
90
  expected_text = "The request www.example.com was expected to execute at most 2 times but it executed 3 times"
91
- expected_text << @executed_requests_info
91
+ expected_text += @executed_requests_info
92
92
  expect(@verifier.failure_message).to eq(expected_text)
93
93
  end
94
94
 
@@ -96,7 +96,7 @@ describe WebMock::RequestExecutionVerifier do
96
96
  @verifier.times_executed = 2
97
97
  @verifier.at_most_times_executed = 1
98
98
  expected_text = "The request www.example.com was expected to execute at most 1 time but it executed 2 times"
99
- expected_text << @executed_requests_info
99
+ expected_text += @executed_requests_info
100
100
  expect(@verifier.failure_message).to eq(expected_text)
101
101
  end
102
102
  end
@@ -108,14 +108,14 @@ describe WebMock::RequestExecutionVerifier do
108
108
  @verifier.times_executed = 2
109
109
  @verifier.expected_times_executed = 2
110
110
  expected_text = "The request www.example.com was not expected to execute 2 times but it executed 2 times"
111
- expected_text << @executed_requests_info
111
+ expected_text += @executed_requests_info
112
112
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
113
113
  end
114
114
 
115
115
  it "reports failure message when not expected request but it executed" do
116
116
  @verifier.times_executed = 1
117
117
  expected_text = "The request www.example.com was not expected to execute but it executed 1 time"
118
- expected_text << @executed_requests_info
118
+ expected_text += @executed_requests_info
119
119
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
120
120
  end
121
121
 
@@ -124,7 +124,7 @@ describe WebMock::RequestExecutionVerifier do
124
124
  @verifier.times_executed = 3
125
125
  @verifier.at_least_times_executed = 2
126
126
  expected_text = "The request www.example.com was not expected to execute at least 2 times but it executed 3 times"
127
- expected_text << @executed_requests_info
127
+ expected_text += @executed_requests_info
128
128
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
129
129
  end
130
130
 
@@ -132,7 +132,7 @@ describe WebMock::RequestExecutionVerifier do
132
132
  @verifier.times_executed = 2
133
133
  @verifier.at_least_times_executed = 2
134
134
  expected_text = "The request www.example.com was not expected to execute at least 2 times but it executed 2 times"
135
- expected_text << @executed_requests_info
135
+ expected_text += @executed_requests_info
136
136
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
137
137
  end
138
138
  end
@@ -142,7 +142,7 @@ describe WebMock::RequestExecutionVerifier do
142
142
  @verifier.times_executed = 2
143
143
  @verifier.at_most_times_executed = 3
144
144
  expected_text = "The request www.example.com was not expected to execute at most 3 times but it executed 2 times"
145
- expected_text << @executed_requests_info
145
+ expected_text += @executed_requests_info
146
146
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
147
147
  end
148
148
 
@@ -150,7 +150,7 @@ describe WebMock::RequestExecutionVerifier do
150
150
  @verifier.times_executed = 1
151
151
  @verifier.at_most_times_executed = 2
152
152
  expected_text = "The request www.example.com was not expected to execute at most 2 times but it executed 1 time"
153
- expected_text << @executed_requests_info
153
+ expected_text += @executed_requests_info
154
154
  expect(@verifier.failure_message_when_negated).to eq(expected_text)
155
155
  end
156
156
  end