webmock 1.20.3 → 1.20.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/README.md +21 -22
  3. data/lib/webmock/matchers/hash_including_matcher.rb +1 -1
  4. data/lib/webmock/version.rb +1 -1
  5. data/spec/acceptance/curb/curb_spec.rb +36 -36
  6. data/spec/acceptance/em_http_request/em_http_request_spec.rb +24 -24
  7. data/spec/acceptance/excon/excon_spec.rb +11 -11
  8. data/spec/acceptance/httpclient/httpclient_spec.rb +9 -9
  9. data/spec/acceptance/net_http/net_http_shared.rb +23 -23
  10. data/spec/acceptance/net_http/net_http_spec.rb +29 -29
  11. data/spec/acceptance/patron/patron_spec.rb +11 -11
  12. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +29 -29
  13. data/spec/acceptance/shared/callbacks.rb +18 -18
  14. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +3 -3
  15. data/spec/acceptance/shared/enabling_and_disabling_webmock.rb +10 -10
  16. data/spec/acceptance/shared/precedence_of_stubs.rb +2 -2
  17. data/spec/acceptance/shared/request_expectations.rb +302 -302
  18. data/spec/acceptance/shared/returning_declared_responses.rb +92 -92
  19. data/spec/acceptance/shared/stubbing_requests.rb +103 -103
  20. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +8 -8
  21. data/spec/quality_spec.rb +3 -3
  22. data/spec/spec_helper.rb +0 -6
  23. data/spec/unit/errors_spec.rb +16 -16
  24. data/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +1 -1
  25. data/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +2 -2
  26. data/spec/unit/rack_response_spec.rb +14 -14
  27. data/spec/unit/request_execution_verifier_spec.rb +31 -31
  28. data/spec/unit/request_pattern_spec.rb +202 -197
  29. data/spec/unit/request_registry_spec.rb +10 -9
  30. data/spec/unit/request_signature_spec.rb +21 -20
  31. data/spec/unit/request_stub_spec.rb +54 -53
  32. data/spec/unit/response_spec.rb +44 -44
  33. data/spec/unit/stub_registry_spec.rb +15 -15
  34. data/spec/unit/stub_request_snippet_spec.rb +8 -8
  35. data/spec/unit/util/hash_counter_spec.rb +6 -6
  36. data/spec/unit/util/hash_keys_stringifier_spec.rb +1 -1
  37. data/spec/unit/util/headers_spec.rb +4 -4
  38. data/spec/unit/util/json_spec.rb +1 -1
  39. data/spec/unit/util/uri_spec.rb +30 -30
  40. data/spec/unit/util/version_checker_spec.rb +9 -9
  41. data/spec/unit/webmock_spec.rb +1 -1
  42. data/webmock.gemspec +1 -1
  43. metadata +10 -9
@@ -8,12 +8,12 @@ describe "Excon" do
8
8
 
9
9
  it 'should allow Excon requests to use query hash paramters' do
10
10
  stub_request(:get, "http://example.com/resource/?a=1&b=2").to_return(:body => "abc")
11
- Excon.new('http://example.com').get(:path => "resource/", :query => {:a => 1, :b => 2}).body.should == "abc"
11
+ expect(Excon.new('http://example.com').get(:path => "resource/", :query => {:a => 1, :b => 2}).body).to eq("abc")
12
12
  end
13
13
 
14
14
  it 'should support Excon :expects options' do
15
15
  stub_request(:get, "http://example.com/").to_return(:body => 'a')
16
- lambda { Excon.new('http://example.com').get(:expects => 204) }.should raise_error(Excon::Errors::OK)
16
+ expect { Excon.new('http://example.com').get(:expects => 204) }.to raise_error(Excon::Errors::OK)
17
17
  end
18
18
 
19
19
  context "with response_block" do
@@ -21,16 +21,16 @@ describe "Excon" do
21
21
  a = []
22
22
  WebMock.allow_net_connect!
23
23
  r = Excon.new('http://httpstat.us/200').get(:response_block => lambda {|e, remaining, total| a << e}, :chunk_size => 1)
24
- a.should == ["2", "0", "0", " ", "O", "K"]
25
- r.body.should == ""
24
+ expect(a).to eq(["2", "0", "0", " ", "O", "K"])
25
+ expect(r.body).to eq("")
26
26
  end
27
27
 
28
28
  it "should support excon response_block" do
29
29
  a = []
30
30
  stub_request(:get, "http://example.com/").to_return(:body => "abc")
31
31
  r = Excon.new('http://example.com').get(:response_block => lambda {|e, remaining, total| a << e}, :chunk_size => 1)
32
- a.should == ['a', 'b', 'c']
33
- r.body.should == ""
32
+ expect(a).to eq(['a', 'b', 'c'])
33
+ expect(r.body).to eq("")
34
34
  end
35
35
 
36
36
  it "should invoke callbacks with response body even if a real request is made", :net_connect => true do
@@ -41,9 +41,9 @@ describe "Excon" do
41
41
  response = res
42
42
  }
43
43
  r = Excon.new('http://httpstat.us/200').get(:response_block => lambda {|e, remaining, total| a << e}, :chunk_size => 1)
44
- response.body.should == "200 OK"
45
- a.should == ["2", "0", "0", " ", "O", "K"]
46
- r.body.should == ""
44
+ expect(response.body).to eq("200 OK")
45
+ expect(a).to eq(["2", "0", "0", " ", "O", "K"])
46
+ expect(r.body).to eq("")
47
47
  end
48
48
  end
49
49
 
@@ -60,14 +60,14 @@ describe "Excon" do
60
60
 
61
61
  Excon.new("http://example.com").put(:path => "upload", :body => file)
62
62
 
63
- yielded_request_body.should eq(file_contents)
63
+ expect(yielded_request_body).to eq(file_contents)
64
64
  end
65
65
 
66
66
  describe '.request_params_from' do
67
67
 
68
68
  it 'rejects invalid request keys' do
69
69
  request_params = WebMock::HttpLibAdapters::ExconAdapter.request_params_from(:body => :keep, :fake => :reject)
70
- request_params.should eq(:body => :keep)
70
+ expect(request_params).to eq(:body => :keep)
71
71
  end
72
72
 
73
73
  end
@@ -20,14 +20,14 @@ describe "HTTPClient" do
20
20
  http_request(:get, "http://www.example.com/") do |body|
21
21
  response_body = body
22
22
  end
23
- response_body.should == "abc"
23
+ expect(response_body).to eq("abc")
24
24
  end
25
25
 
26
26
  it "should match requests if headers are the same but in different order" do
27
27
  stub_request(:get, "www.example.com").with(:headers => {"a" => ["b", "c"]} )
28
- http_request(
28
+ expect(http_request(
29
29
  :get, "http://www.example.com/",
30
- :headers => {"a" => ["c", "b"]}).status.should == "200"
30
+ :headers => {"a" => ["c", "b"]}).status).to eq("200")
31
31
  end
32
32
 
33
33
  describe "when using async requests" do
@@ -44,7 +44,7 @@ describe "HTTPClient" do
44
44
  HTTPClient.get_content('www.example.com') do |content|
45
45
  str << content
46
46
  end
47
- str.should == 'test'
47
+ expect(str).to eq('test')
48
48
  end
49
49
 
50
50
  context "multipart bodies" do
@@ -91,12 +91,12 @@ describe "HTTPClient" do
91
91
  end
92
92
 
93
93
  it "supports request filters" do
94
- @client.request(:get, 'http://www.example.com/').status.should == 200
94
+ expect(@client.request(:get, 'http://www.example.com/').status).to eq(200)
95
95
  end
96
96
 
97
97
  it "supports response filters" do
98
98
  res = @client.request(:get, 'http://www.example.com/')
99
- res.header['X-Powered-By'].first.should == 'webmock'
99
+ expect(res.header['X-Powered-By'].first).to eq('webmock')
100
100
  end
101
101
  end
102
102
 
@@ -121,9 +121,9 @@ describe "HTTPClient" do
121
121
  :headers => { "Cookie" => "bar=; foo=" })
122
122
  http_request(:get, webmock_server_url, :client => client)
123
123
 
124
- request_signatures.should have(2).signatures
124
+ expect(request_signatures.size).to eq(2)
125
125
  # Verify the request signatures were identical as needed by this example
126
- request_signatures.first.should eq(request_signatures.last)
126
+ expect(request_signatures.first).to eq(request_signatures.last)
127
127
  end
128
128
  end
129
129
 
@@ -157,7 +157,7 @@ describe "HTTPClient" do
157
157
  it 'receives request_method, request_uri, and request_query from the request header' do
158
158
  stub_request :get, 'www.example.com'
159
159
  message = HTTPClient.new.get 'www.example.com'
160
- message.header.request_uri.to_s.should == 'www.example.com'
160
+ expect(message.header.request_uri.to_s).to eq('www.example.com')
161
161
  end
162
162
  end
163
163
  end
@@ -8,7 +8,7 @@ shared_examples_for "Net::HTTP" do
8
8
 
9
9
  it "should return a Net::ReadAdapter from response.body when a real request is made with a block and #read_body", :net_connect => true do
10
10
  response = Net::HTTP.new("localhost", port).request_get('/') { |r| r.read_body { } }
11
- response.body.should be_a(Net::ReadAdapter)
11
+ expect(response.body).to be_a(Net::ReadAdapter)
12
12
  end
13
13
 
14
14
  it "should handle requests with block passed to read_body", :net_connect => true do
@@ -21,7 +21,7 @@ shared_examples_for "Net::HTTP" do
21
21
  end
22
22
  end
23
23
  end
24
- body.should =~ /hello world/
24
+ expect(body).to match(/hello world/)
25
25
  end
26
26
 
27
27
  it "should connect only once when connected on start", :net_connect => true do
@@ -34,25 +34,25 @@ shared_examples_for "Net::HTTP" do
34
34
  }
35
35
 
36
36
  if !defined?(WebMock::Config) || WebMock::Config.instance.net_http_connect_on_start
37
- socket_id_before_request.should_not == nil.object_id
38
- socket_id_after_request.should_not == nil.object_id
39
- socket_id_after_request.should == socket_id_before_request
37
+ expect(socket_id_before_request).not_to eq(nil.object_id)
38
+ expect(socket_id_after_request).not_to eq(nil.object_id)
39
+ expect(socket_id_after_request).to eq(socket_id_before_request)
40
40
  else
41
- socket_id_before_request.should == nil.object_id
42
- socket_id_after_request.should_not == nil.object_id
41
+ expect(socket_id_before_request).to eq(nil.object_id)
42
+ expect(socket_id_after_request).not_to eq(nil.object_id)
43
43
  end
44
44
  end
45
45
 
46
46
  describe "without start" do
47
47
  it "should close connection after a real request" do
48
48
  @http.get('/') { }
49
- @http.should_not be_started
49
+ expect(@http).not_to be_started
50
50
  end
51
51
 
52
52
  it "should execute block exactly once" do
53
53
  times = 0
54
54
  @http.get('/') { times += 1 }
55
- times.should == 1
55
+ expect(times).to eq(1)
56
56
  end
57
57
 
58
58
  it "should have socket open during a real request" do
@@ -60,7 +60,7 @@ shared_examples_for "Net::HTTP" do
60
60
  @http.get('/') {
61
61
  socket_id = @http.instance_variable_get(:@socket).object_id
62
62
  }
63
- socket_id.should_not be_nil
63
+ expect(socket_id).not_to be_nil
64
64
  end
65
65
 
66
66
  it "should be started during a real request" do
@@ -68,21 +68,21 @@ shared_examples_for "Net::HTTP" do
68
68
  @http.get('/') {
69
69
  started = @http.started?
70
70
  }
71
- started.should == true
72
- @http.started?.should == false
71
+ expect(started).to eq(true)
72
+ expect(@http.started?).to eq(false)
73
73
  end
74
74
  end
75
75
 
76
76
  describe "with start" do
77
77
  it "should close connection after a real request" do
78
78
  @http.start {|conn| conn.get('/') { } }
79
- @http.should_not be_started
79
+ expect(@http).not_to be_started
80
80
  end
81
81
 
82
82
  it "should execute block exactly once" do
83
83
  times = 0
84
84
  @http.start {|conn| conn.get('/') { times += 1 }}
85
- times.should == 1
85
+ expect(times).to eq(1)
86
86
  end
87
87
 
88
88
  it "should have socket open during a real request" do
@@ -91,7 +91,7 @@ shared_examples_for "Net::HTTP" do
91
91
  socket_id = conn.instance_variable_get(:@socket).object_id
92
92
  }
93
93
  }
94
- socket_id.should_not be_nil
94
+ expect(socket_id).not_to be_nil
95
95
  end
96
96
 
97
97
  it "should be started during a real request" do
@@ -100,15 +100,15 @@ shared_examples_for "Net::HTTP" do
100
100
  started = conn.started?
101
101
  }
102
102
  }
103
- started.should == true
104
- @http.started?.should == false
103
+ expect(started).to eq(true)
104
+ expect(@http.started?).to eq(false)
105
105
  end
106
106
  end
107
107
 
108
108
  describe "with start without request block" do
109
109
  it "should close connection after a real request" do
110
110
  @http.start {|conn| conn.get('/') }
111
- @http.should_not be_started
111
+ expect(@http).not_to be_started
112
112
  end
113
113
 
114
114
  it "should have socket open during a real request" do
@@ -116,7 +116,7 @@ shared_examples_for "Net::HTTP" do
116
116
  @http.start {|conn|
117
117
  socket_id = conn.instance_variable_get(:@socket).object_id
118
118
  }
119
- socket_id.should_not be_nil
119
+ expect(socket_id).not_to be_nil
120
120
  end
121
121
 
122
122
  it "should be started during a real request" do
@@ -124,8 +124,8 @@ shared_examples_for "Net::HTTP" do
124
124
  @http.start {|conn|
125
125
  started = conn.started?
126
126
  }
127
- started.should == true
128
- @http.started?.should == false
127
+ expect(started).to eq(true)
128
+ expect(@http.started?).to eq(false)
129
129
  end
130
130
  end
131
131
 
@@ -133,9 +133,9 @@ shared_examples_for "Net::HTTP" do
133
133
  it "should gracefully start and close connection" do
134
134
  @http.start
135
135
  @http.get("/")
136
- @http.should be_started
136
+ expect(@http).to be_started
137
137
  @http.finish
138
- @http.should_not be_started
138
+ expect(@http).not_to be_started
139
139
  end
140
140
  end
141
141
  end
@@ -58,32 +58,32 @@ describe "Net:HTTP" do
58
58
 
59
59
  describe "constants" do
60
60
  it "should still have const Get defined on replaced Net::HTTP" do
61
- Object.const_get("Net").const_get("HTTP").const_defined?("Get").should be_true
61
+ expect(Object.const_get("Net").const_get("HTTP").const_defined?("Get")).to be_truthy
62
62
  end
63
63
 
64
64
  it "should still have const Get within constants on replaced Net::HTTP" do
65
- Object.const_get("Net").const_get("HTTP").constants.map(&:to_s).should include("Get")
65
+ expect(Object.const_get("Net").const_get("HTTP").constants.map(&:to_s)).to include("Get")
66
66
  end
67
67
 
68
68
  it "should still have const Get within constants on replaced Net::HTTP" do
69
- Object.const_get("Net").const_get("HTTP").const_get("Get").should_not be_nil
69
+ expect(Object.const_get("Net").const_get("HTTP").const_get("Get")).not_to be_nil
70
70
  end
71
71
 
72
72
  if Module.method(:const_defined?).arity != 1
73
73
  it "should still have const Get defined (and not inherited) on replaced Net::HTTP" do
74
- Object.const_get("Net").const_get("HTTP").const_defined?("Get", false).should be_true
74
+ expect(Object.const_get("Net").const_get("HTTP").const_defined?("Get", false)).to be_truthy
75
75
  end
76
76
  end
77
77
 
78
78
  if Module.method(:const_get).arity != 1
79
79
  it "should still be able to get non inherited constant Get on replaced Net::HTTP" do
80
- Object.const_get("Net").const_get("HTTP").const_get("Get", false).should_not be_nil
80
+ expect(Object.const_get("Net").const_get("HTTP").const_get("Get", false)).not_to be_nil
81
81
  end
82
82
  end
83
83
 
84
84
  if Module.method(:constants).arity != 0
85
85
  it "should still Get within non inherited constants on replaced Net::HTTP" do
86
- Object.const_get("Net").const_get("HTTP").constants(false).map(&:to_s).should include("Get")
86
+ expect(Object.const_get("Net").const_get("HTTP").constants(false).map(&:to_s)).to include("Get")
87
87
  end
88
88
  end
89
89
 
@@ -94,22 +94,22 @@ describe "Net:HTTP" do
94
94
  it "Net::HTTP should have the same constants" do
95
95
  orig_consts_number = WebMock::HttpLibAdapters::NetHttpAdapter::OriginalNetHTTP.constants.size
96
96
  Net::HTTP.send(:const_set, "TEST_CONST", 10)
97
- Net::HTTP.constants.size.should == orig_consts_number + 1
97
+ expect(Net::HTTP.constants.size).to eq(orig_consts_number + 1)
98
98
  WebMock.disable!
99
- Net::HTTP.constants.size.should == orig_consts_number + 1
99
+ expect(Net::HTTP.constants.size).to eq(orig_consts_number + 1)
100
100
  end
101
101
  end
102
102
  end
103
103
 
104
104
  it "should work with block provided" do
105
105
  stub_http_request(:get, "www.example.com").to_return(:body => "abc"*100000)
106
- Net::HTTP.start("www.example.com") { |query| query.get("/") }.body.should == "abc"*100000
106
+ expect(Net::HTTP.start("www.example.com") { |query| query.get("/") }.body).to eq("abc"*100000)
107
107
  end
108
108
 
109
109
  it "should handle multiple values for the same response header" do
110
110
  stub_http_request(:get, "www.example.com").to_return(:headers => { 'Set-Cookie' => ['foo=bar', 'bar=bazz'] })
111
111
  response = Net::HTTP.get_response(URI.parse("http://www.example.com/"))
112
- response.get_fields('Set-Cookie').should == ['bar=bazz', 'foo=bar']
112
+ expect(response.get_fields('Set-Cookie')).to eq(['bar=bazz', 'foo=bar'])
113
113
  end
114
114
 
115
115
  it "should yield block on response" do
@@ -118,49 +118,49 @@ describe "Net:HTTP" do
118
118
  http_request(:get, "http://www.example.com/") do |response|
119
119
  response_body = response.body
120
120
  end
121
- response_body.should == "abc"
121
+ expect(response_body).to eq("abc")
122
122
  end
123
123
 
124
124
  it "should handle Net::HTTP::Post#body" do
125
125
  stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
126
126
  req = Net::HTTP::Post.new("/")
127
127
  req.body = "my_params"
128
- Net::HTTP.start("www.example.com") { |http| http.request(req)}.body.should == "abc"
128
+ expect(Net::HTTP.start("www.example.com") { |http| http.request(req)}.body).to eq("abc")
129
129
  end
130
130
 
131
131
  it "should handle Net::HTTP::Post#body_stream" do
132
132
  stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
133
133
  req = Net::HTTP::Post.new("/")
134
134
  req.body_stream = StringIO.new("my_params")
135
- Net::HTTP.start("www.example.com") { |http| http.request(req)}.body.should == "abc"
135
+ expect(Net::HTTP.start("www.example.com") { |http| http.request(req)}.body).to eq("abc")
136
136
  end
137
137
 
138
138
  it "should behave like Net::HTTP and raise error if both request body and body argument are set" do
139
139
  stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
140
140
  req = Net::HTTP::Post.new("/")
141
141
  req.body = "my_params"
142
- lambda {
142
+ expect {
143
143
  Net::HTTP.start("www.example.com") { |http| http.request(req, "my_params")}
144
- }.should raise_error("both of body argument and HTTPRequest#body set")
144
+ }.to raise_error("both of body argument and HTTPRequest#body set")
145
145
  end
146
146
 
147
147
  it "should return a Net::ReadAdapter from response.body when a stubbed request is made with a block and #read_body" do
148
148
  WebMock.stub_request(:get, 'http://example.com/').to_return(:body => "the body")
149
149
  response = Net::HTTP.new('example.com', 80).request_get('/') { |r| r.read_body { } }
150
- response.body.should be_a(Net::ReadAdapter)
150
+ expect(response.body).to be_a(Net::ReadAdapter)
151
151
  end
152
152
 
153
153
  it "should have request 1 time executed in registry after 1 real request", :net_connect => true do
154
154
  WebMock.allow_net_connect!
155
155
  http = Net::HTTP.new('localhost', port)
156
156
  http.get('/') {}
157
- WebMock::RequestRegistry.instance.requested_signatures.hash.size.should == 1
158
- WebMock::RequestRegistry.instance.requested_signatures.hash.values.first.should == 1
157
+ expect(WebMock::RequestRegistry.instance.requested_signatures.hash.size).to eq(1)
158
+ expect(WebMock::RequestRegistry.instance.requested_signatures.hash.values.first).to eq(1)
159
159
  end
160
160
 
161
161
  it "should work with Addressable::URI passed to Net::HTTP.get_response" do
162
162
  stub_request(:get, 'http://www.example.com/hello?a=1').to_return(:body => "abc")
163
- Net::HTTP.get_response(Addressable::URI.parse('http://www.example.com/hello?a=1')).body.should == "abc"
163
+ expect(Net::HTTP.get_response(Addressable::URI.parse('http://www.example.com/hello?a=1')).body).to eq("abc")
164
164
  end
165
165
 
166
166
  describe "connecting on Net::HTTP.start" do
@@ -173,7 +173,7 @@ describe "Net:HTTP" do
173
173
  it "should not connect to the server until the request", :net_connect => true do
174
174
  WebMock.allow_net_connect!
175
175
  @http.start {|conn|
176
- conn.peer_cert.should be_nil
176
+ expect(conn.peer_cert).to be_nil
177
177
  }
178
178
  end
179
179
 
@@ -181,7 +181,7 @@ describe "Net:HTTP" do
181
181
  WebMock.allow_net_connect!(:net_http_connect_on_start => true)
182
182
  @http.start {|conn|
183
183
  cert = OpenSSL::X509::Certificate.new conn.peer_cert
184
- cert.should be_a(OpenSSL::X509::Certificate)
184
+ expect(cert).to be_a(OpenSSL::X509::Certificate)
185
185
  }
186
186
  end
187
187
 
@@ -191,7 +191,7 @@ describe "Net:HTTP" do
191
191
  it "should not connect to the server until the request", :net_connect => true do
192
192
  WebMock.disable_net_connect!(:allow => "www.google.com")
193
193
  @http.start {|conn|
194
- conn.peer_cert.should be_nil
194
+ expect(conn.peer_cert).to be_nil
195
195
  }
196
196
  end
197
197
 
@@ -199,7 +199,7 @@ describe "Net:HTTP" do
199
199
  WebMock.disable_net_connect!(:allow => "www.google.com", :net_http_connect_on_start => true)
200
200
  @http.start {|conn|
201
201
  cert = OpenSSL::X509::Certificate.new conn.peer_cert
202
- cert.should be_a(OpenSSL::X509::Certificate)
202
+ expect(cert).to be_a(OpenSSL::X509::Certificate)
203
203
  }
204
204
  end
205
205
 
@@ -258,21 +258,21 @@ describe "Net:HTTP" do
258
258
  http_request(:get, "http://localhost:#{port}/") do |response|
259
259
  response.read_body { |fragment| response_body << fragment }
260
260
  end
261
- response_body.should =~ expected_body_regex
261
+ expect(response_body).to match(expected_body_regex)
262
262
 
263
- @callback_response.body.should == response_body
263
+ expect(@callback_response.body).to eq(response_body)
264
264
  end
265
265
 
266
266
  it "should support the after_request callback on a request with a returning block" do
267
267
  response_body = perform_get_with_returning_block
268
- response_body.should =~ expected_body_regex
269
- @callback_response.should be_instance_of(WebMock::Response)
270
- @callback_response.body.should == response_body
268
+ expect(response_body).to match(expected_body_regex)
269
+ expect(@callback_response).to be_instance_of(WebMock::Response)
270
+ expect(@callback_response.body).to eq(response_body)
271
271
  end
272
272
 
273
273
  it "should only invoke the after_request callback once, even for a recursive post request" do
274
274
  Net::HTTP.new('localhost', port).post('/', nil)
275
- @callback_invocation_count.should == 1
275
+ expect(@callback_invocation_count).to eq(1)
276
276
  end
277
277
  end
278
278
  end