webmock 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +7 -7
- data/CHANGELOG.md +45 -0
- data/README.md +16 -2
- data/lib/webmock.rb +3 -0
- data/lib/webmock/api.rb +8 -0
- data/lib/webmock/http_lib_adapters/curb_adapter.rb +1 -1
- data/lib/webmock/http_lib_adapters/excon_adapter.rb +1 -1
- data/lib/webmock/http_lib_adapters/http_rb/request.rb +7 -1
- data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +4 -0
- data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +1 -1
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +5 -3
- data/lib/webmock/http_lib_adapters/net_http.rb +2 -2
- data/lib/webmock/http_lib_adapters/patron_adapter.rb +2 -2
- data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/lib/webmock/matchers/hash_including_matcher.rb +4 -23
- data/lib/webmock/rack_response.rb +1 -1
- data/lib/webmock/request_execution_verifier.rb +2 -3
- data/lib/webmock/request_pattern.rb +9 -2
- data/lib/webmock/request_registry.rb +1 -1
- data/lib/webmock/request_signature.rb +1 -1
- data/lib/webmock/request_signature_snippet.rb +4 -4
- data/lib/webmock/stub_request_snippet.rb +2 -2
- data/lib/webmock/util/headers.rb +2 -2
- data/lib/webmock/util/query_mapper.rb +3 -3
- data/lib/webmock/version.rb +1 -1
- data/minitest/webmock_spec.rb +2 -2
- data/spec/acceptance/http_rb/http_rb_spec.rb +9 -0
- data/spec/acceptance/http_rb/http_rb_spec_helper.rb +1 -1
- data/spec/acceptance/httpclient/httpclient_spec.rb +8 -1
- data/spec/acceptance/net_http/net_http_shared.rb +1 -1
- data/spec/acceptance/net_http/net_http_spec.rb +15 -1
- data/spec/acceptance/patron/patron_spec_helper.rb +1 -1
- data/spec/acceptance/shared/request_expectations.rb +7 -0
- data/spec/acceptance/shared/stubbing_requests.rb +5 -0
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +1 -1
- data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +1 -1
- data/spec/unit/api_spec.rb +84 -3
- data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/spec/unit/request_execution_verifier_spec.rb +12 -12
- data/test/shared_test.rb +15 -2
- metadata +44 -39
@@ -10,10 +10,10 @@ module WebMock
|
|
10
10
|
|
11
11
|
def to_s(with_response = true)
|
12
12
|
request_pattern = @request_stub.request_pattern
|
13
|
-
string = "stub_request(:#{request_pattern.method_pattern.to_s},"
|
13
|
+
string = "stub_request(:#{request_pattern.method_pattern.to_s},".dup
|
14
14
|
string << " \"#{request_pattern.uri_pattern.to_s}\")"
|
15
15
|
|
16
|
-
with = ""
|
16
|
+
with = "".dup
|
17
17
|
|
18
18
|
if (request_pattern.body_pattern)
|
19
19
|
with << "body: #{request_pattern.body_pattern.to_s}"
|
data/lib/webmock/util/headers.rb
CHANGED
@@ -12,7 +12,7 @@ module WebMock
|
|
12
12
|
[name.to_s.split(/_|-/).map { |segment| segment.capitalize }.join("-"),
|
13
13
|
case value
|
14
14
|
when Regexp then value
|
15
|
-
when Array then (value.size == 1) ? value.first : value.map {|v| v.to_s}.sort
|
15
|
+
when Array then (value.size == 1) ? value.first.to_s : value.map {|v| v.to_s}.sort
|
16
16
|
else value.to_s
|
17
17
|
end
|
18
18
|
]
|
@@ -22,7 +22,7 @@ module WebMock
|
|
22
22
|
|
23
23
|
def self.sorted_headers_string(headers)
|
24
24
|
headers = WebMock::Util::Headers.normalize_headers(headers)
|
25
|
-
str = '{'
|
25
|
+
str = '{'.dup
|
26
26
|
str << headers.map do |k,v|
|
27
27
|
v = case v
|
28
28
|
when Regexp then v.inspect
|
@@ -204,7 +204,7 @@ module WebMock::Util
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
buffer = ''
|
207
|
+
buffer = ''.dup
|
208
208
|
new_query_values.each do |parent, value|
|
209
209
|
encoded_parent = ::Addressable::URI.encode_component(
|
210
210
|
parent.dup, ::Addressable::URI::CharacterClasses::UNRESERVED
|
@@ -251,14 +251,14 @@ module WebMock::Util
|
|
251
251
|
]
|
252
252
|
end
|
253
253
|
value.sort!
|
254
|
-
buffer = ''
|
254
|
+
buffer = ''.dup
|
255
255
|
value.each do |key, val|
|
256
256
|
new_parent = options[:notation] != :flat_array ? "#{parent}[#{key}]" : parent
|
257
257
|
buffer << "#{to_query(new_parent, val, options)}&"
|
258
258
|
end
|
259
259
|
buffer.chop
|
260
260
|
when ::Array
|
261
|
-
buffer = ''
|
261
|
+
buffer = ''.dup
|
262
262
|
value.each_with_index do |val, i|
|
263
263
|
new_parent = options[:notation] != :flat_array ? "#{parent}[#{i}]" : parent
|
264
264
|
buffer << "#{to_query(new_parent, val, options)}&"
|
data/lib/webmock/version.rb
CHANGED
data/minitest/webmock_spec.rb
CHANGED
@@ -43,7 +43,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
|
43
43
|
|
44
44
|
it "should verify that expect request didn't occur" do
|
45
45
|
expected_message = "The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times"
|
46
|
-
expected_message
|
46
|
+
expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
|
47
47
|
assert_fail(expected_message) do
|
48
48
|
assert_requested(:get, "http://www.example.com")
|
49
49
|
end
|
@@ -51,7 +51,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
|
51
51
|
|
52
52
|
it "should verify that expect stub didn't occur" do
|
53
53
|
expected_message = "The request ANY http://www.example.com/ was expected to execute 1 time but it executed 0 times"
|
54
|
-
expected_message
|
54
|
+
expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
|
55
55
|
assert_fail(expected_message) do
|
56
56
|
assert_requested(@stub_http)
|
57
57
|
end
|
@@ -70,4 +70,13 @@ describe "HTTP.rb" do
|
|
70
70
|
expect(response.uri.to_s).to eq "http://example.com/foo"
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
context "streamer" do
|
75
|
+
it "can be closed" do
|
76
|
+
stub_request :get, "example.com/foo"
|
77
|
+
response = HTTP.get "http://example.com/foo"
|
78
|
+
|
79
|
+
response.connection.close
|
80
|
+
end
|
81
|
+
end
|
73
82
|
end
|
@@ -31,6 +31,13 @@ describe "HTTPClient" do
|
|
31
31
|
expect(response_body).to eq("abc")
|
32
32
|
end
|
33
33
|
|
34
|
+
it "should not yield block on empty response if block provided" do
|
35
|
+
stub_request(:get, "www.example.com").to_return(body: "")
|
36
|
+
response_body = ""
|
37
|
+
http_request(:get, "http://www.example.com/"){ raise }
|
38
|
+
expect(response_body).to eq("")
|
39
|
+
end
|
40
|
+
|
34
41
|
it "should match requests if headers are the same but in different order" do
|
35
42
|
stub_request(:get, "www.example.com").with(headers: {"a" => ["b", "c"]} )
|
36
43
|
expect(http_request(
|
@@ -48,7 +55,7 @@ describe "HTTPClient" do
|
|
48
55
|
|
49
56
|
it "should work with get_content" do
|
50
57
|
stub_request(:get, 'www.example.com').to_return(status: 200, body: 'test', headers: {})
|
51
|
-
str = ''
|
58
|
+
str = ''.dup
|
52
59
|
HTTPClient.get_content('www.example.com') do |content|
|
53
60
|
str << content
|
54
61
|
end
|
@@ -12,7 +12,7 @@ shared_examples_for "Net::HTTP" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should handle requests with block passed to read_body", net_connect: true do
|
15
|
-
body = ""
|
15
|
+
body = "".dup
|
16
16
|
req = Net::HTTP::Get.new("/")
|
17
17
|
Net::HTTP.start("localhost", port) do |http|
|
18
18
|
http.request(req) do |res|
|
@@ -293,7 +293,7 @@ describe "Net:HTTP" do
|
|
293
293
|
end
|
294
294
|
|
295
295
|
it "should support the after_request callback on an request with block and read_body" do
|
296
|
-
response_body = ''
|
296
|
+
response_body = ''.dup
|
297
297
|
http_request(:get, "http://localhost:#{port}/") do |response|
|
298
298
|
response.read_body { |fragment| response_body << fragment }
|
299
299
|
end
|
@@ -314,4 +314,18 @@ describe "Net:HTTP" do
|
|
314
314
|
expect(@callback_invocation_count).to eq(1)
|
315
315
|
end
|
316
316
|
end
|
317
|
+
|
318
|
+
it "should match http headers, even if their values have been set in a request as numbers" do
|
319
|
+
WebMock.disable_net_connect!
|
320
|
+
|
321
|
+
stub_request(:post, "www.example.com").with(headers: {"My-Header" => 99})
|
322
|
+
|
323
|
+
uri = URI.parse('http://www.example.com/')
|
324
|
+
req = Net::HTTP::Post.new(uri.path)
|
325
|
+
req['My-Header'] = 99
|
326
|
+
|
327
|
+
res = Net::HTTP.start(uri.host, uri.port) do |http|
|
328
|
+
http.request(req, '')
|
329
|
+
end
|
330
|
+
end
|
317
331
|
end
|
@@ -16,7 +16,7 @@ module PatronSpecHelper
|
|
16
16
|
sess.timeout = 30
|
17
17
|
sess.max_redirects = 0
|
18
18
|
uri = "#{uri.path}#{uri.query ? '?' : ''}#{uri.query}"
|
19
|
-
uri.gsub
|
19
|
+
uri = uri.gsub(' ','%20')
|
20
20
|
response = sess.request(method, uri, options[:headers] || {}, {
|
21
21
|
data: options[:body]
|
22
22
|
})
|
@@ -165,6 +165,13 @@ shared_context "request expectations" do |*adapter_info|
|
|
165
165
|
expect(a_request(:get, "www.example.com").with(query: hash_including({"a" => ["b", "c"]}))).to have_been_made
|
166
166
|
}.not_to raise_error
|
167
167
|
end
|
168
|
+
|
169
|
+
it 'should satisfy expectation if the request was executed with excluding part of query params declared as a hash in a query option' do
|
170
|
+
expect {
|
171
|
+
http_request(:get, "http://www.example.com/?a[]=d&b[]=e&b=1")
|
172
|
+
expect(a_request(:get, "www.example.com").with(query: hash_excluding(a: ['b', 'c']))).to have_been_made
|
173
|
+
}.not_to raise_error
|
174
|
+
end
|
168
175
|
end
|
169
176
|
|
170
177
|
context "when using flat array notation" do
|
@@ -63,6 +63,11 @@ 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
|
66
71
|
end
|
67
72
|
|
68
73
|
describe "based on method" do
|
@@ -6,7 +6,7 @@ module TyphoeusHydraSpecHelper
|
|
6
6
|
|
7
7
|
|
8
8
|
def http_request(method, uri, options = {}, &block)
|
9
|
-
uri.gsub
|
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],
|
data/spec/unit/api_spec.rb
CHANGED
@@ -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,88 @@ 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
|
73
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
|
74
155
|
end
|
75
156
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
153
|
+
expected_text += @executed_requests_info
|
154
154
|
expect(@verifier.failure_message_when_negated).to eq(expected_text)
|
155
155
|
end
|
156
156
|
end
|