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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.20.4
4
+
5
+ * Fixed support for `hash_including` matcher in RSpec 3
6
+
3
7
  ## 1.20.3
4
8
 
5
9
  * `with` method raises error if provided without options hash and without block
data/README.md CHANGED
@@ -540,52 +540,51 @@ assert_not_requested(stub_post)
540
540
  ```ruby
541
541
  require 'webmock/rspec'
542
542
 
543
- WebMock.should have_requested(:get, "www.example.com").
543
+ expect(WebMock).to have_requested(:get, "www.example.com").
544
544
  with(:body => "abc", :headers => {'Content-Length' => 3}).twice
545
545
 
546
- WebMock.should_not have_requested(:get, "www.something.com")
546
+ expect(WebMock).not_to have_requested(:get, "www.something.com")
547
547
 
548
- WebMock.should have_requested(:post, "www.example.com").with { |req| req.body == "abc" }
548
+ expect(WebMock).to have_requested(:post, "www.example.com").with { |req| req.body == "abc" }
549
549
  # Note that the block with `do ... end` instead of curly brackets won't work!
550
550
  # Why? See this comment https://github.com/bblimke/webmock/issues/174#issuecomment-34908908
551
551
 
552
- WebMock.should have_requested(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})
552
+ expect(WebMock).to have_requested(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})
553
553
 
554
- WebMock.should have_requested(:get, "www.example.com").
554
+ expect(WebMock).to have_requested(:get, "www.example.com").
555
555
  with(:query => hash_including({"a" => ["b", "c"]}))
556
556
 
557
- WebMock.should have_requested(:get, "www.example.com").
557
+ expect(WebMock).to have_requested(:get, "www.example.com").
558
558
  with(:body => {"a" => ["b", "c"]}, :headers => {'Content-Type' => 'application/json'})
559
559
  ```
560
560
 
561
561
  ### Setting expectations in RSpec with `a_request`
562
562
 
563
563
  ```ruby
564
- a_request(:post, "www.example.com").
565
- with(:body => "abc", :headers => {'Content-Length' => 3}).should have_been_made.once
564
+ expect(a_request(:post, "www.example.com").
565
+ with(:body => "abc", :headers => {'Content-Length' => 3})).to have_been_made.once
566
566
 
567
- a_request(:post, "www.something.com").should have_been_made.times(3)
567
+ expect(a_request(:post, "www.something.com")).to have_been_made.times(3)
568
568
 
569
- a_request(:post, "www.something.com").should have_been_made.at_least_once
569
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_least_once
570
570
 
571
- a_request(:post, "www.something.com").should have_been_made.at_least_times(3)
571
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_least_times(3)
572
572
 
573
- a_request(:post, "www.something.com").should have_been_made.at_most_twice
573
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_twice
574
574
 
575
- a_request(:post, "www.something.com").should have_been_made.at_most_times(3)
575
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_times(3)
576
576
 
577
- a_request(:any, "www.example.com").should_not have_been_made
577
+ expect(a_request(:any, "www.example.com")).not_to have_been_made
578
578
 
579
- a_request(:post, "www.example.com").with { |req| req.body == "abc" }.should have_been_made
579
+ expect(a_request(:post, "www.example.com").with { |req| req.body == "abc" }).to have_been_made
580
580
 
581
- a_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made
581
+ expect(a_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})).to have_been_made
582
582
 
583
- a_request(:get, "www.example.com").
584
- with(:query => hash_including({"a" => ["b", "c"]})).should have_been_made
583
+ expect(a_request(:get, "www.example.com").
584
+ with(:query => hash_including({"a" => ["b", "c"]}))).to have_been_made
585
585
 
586
- a_request(:post, "www.example.com").
587
- with(:body => {"a" => ["b", "c"]}, :headers => {'Content-Type' => 'application/json'}).
588
- should have_been_made
586
+ expect(a_request(:post, "www.example.com").
587
+ with(:body => {"a" => ["b", "c"]}, :headers => {'Content-Type' => 'application/json'})).to have_been_made
589
588
  ```
590
589
 
591
590
  ### Setting expectations in RSpec on the stub
@@ -593,7 +592,7 @@ a_request(:post, "www.example.com").
593
592
  ```ruby
594
593
  stub = stub_request(:get, "www.example.com")
595
594
  # ... make requests ...
596
- stub.should have_been_requested
595
+ expect(stub).to have_been_requested
597
596
  ```
598
597
 
599
598
  ## Clearing stubs and request history
@@ -8,7 +8,7 @@ module WebMock
8
8
  end
9
9
 
10
10
  def ==(actual)
11
- @expected.all? {|k,v| actual.has_key?(k) && v == actual[k]}
11
+ @expected.all? {|k,v| actual.has_key?(k) && v === actual[k]}
12
12
  rescue NoMethodError
13
13
  false
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '1.20.3' unless defined?(::WebMock::VERSION)
2
+ VERSION = '1.20.4' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -12,8 +12,8 @@ unless RUBY_PLATFORM =~ /java/
12
12
  describe "when doing PUTs" do
13
13
  it "should stub them" do
14
14
  stub_request(:put, "www.example.com").with(:body => "01234")
15
- http_request(:put, "http://www.example.com", :body => "01234").
16
- status.should == "200"
15
+ expect(http_request(:put, "http://www.example.com", :body => "01234").
16
+ status).to eq("200")
17
17
  end
18
18
  end
19
19
  end
@@ -39,7 +39,7 @@ unless RUBY_PLATFORM =~ /java/
39
39
  test = c.body_str
40
40
  end
41
41
  @curl.http_get
42
- test.should == body
42
+ expect(test).to eq(body)
43
43
  end
44
44
 
45
45
  it "should call on_missing with 4xx response" do
@@ -52,7 +52,7 @@ unless RUBY_PLATFORM =~ /java/
52
52
  test = code
53
53
  end
54
54
  @curl.http_get
55
- test.should == response_code
55
+ expect(test).to eq(response_code)
56
56
  end
57
57
 
58
58
  it "should call on_failure with 5xx response" do
@@ -65,7 +65,7 @@ unless RUBY_PLATFORM =~ /java/
65
65
  test = code
66
66
  end
67
67
  @curl.http_get
68
- test.should == response_code
68
+ expect(test).to eq(response_code)
69
69
  end
70
70
 
71
71
  it "should call on_body when response body is read" do
@@ -78,7 +78,7 @@ unless RUBY_PLATFORM =~ /java/
78
78
  test = data
79
79
  end
80
80
  @curl.http_get
81
- test.should == body
81
+ expect(test).to eq(body)
82
82
  end
83
83
 
84
84
  it "should call on_body for each chunk with chunked response" do
@@ -92,7 +92,7 @@ unless RUBY_PLATFORM =~ /java/
92
92
  test << data
93
93
  end
94
94
  @curl.http_get
95
- test.should == ["first_chunk", "second_chunk"]
95
+ expect(test).to eq(["first_chunk", "second_chunk"])
96
96
  end
97
97
 
98
98
  it "should call on_header when response headers are read" do
@@ -104,10 +104,10 @@ unless RUBY_PLATFORM =~ /java/
104
104
  test << data
105
105
  end
106
106
  @curl.http_get
107
- test.should == [
107
+ expect(test).to eq([
108
108
  "HTTP/1.1 200 \r\n",
109
109
  'One: 1'
110
- ]
110
+ ])
111
111
  end
112
112
 
113
113
  it "should call on_complete when request is complete" do
@@ -119,7 +119,7 @@ unless RUBY_PLATFORM =~ /java/
119
119
  test = curl.body_str
120
120
  end
121
121
  @curl.http_get
122
- test.should == body
122
+ expect(test).to eq(body)
123
123
  end
124
124
 
125
125
  it "should call on_progress when portion of response body is read" do
@@ -127,12 +127,12 @@ unless RUBY_PLATFORM =~ /java/
127
127
 
128
128
  test = nil
129
129
  @curl.on_progress do |*args|
130
- args.length.should == 4
131
- args.each {|arg| arg.is_a?(Float).should == true }
130
+ expect(args.length).to eq(4)
131
+ args.each {|arg| expect(arg.is_a?(Float)).to eq(true) }
132
132
  test = true
133
133
  end
134
134
  @curl.http_get
135
- test.should == true
135
+ expect(test).to eq(true)
136
136
  end
137
137
 
138
138
  it "should call callbacks in correct order on successful request" do
@@ -147,7 +147,7 @@ unless RUBY_PLATFORM =~ /java/
147
147
  @curl.on_progress {|*args| order << :on_progress }
148
148
  @curl.http_get
149
149
 
150
- order.should == [:on_progress,:on_header,:on_body,:on_complete,:on_success]
150
+ expect(order).to eq([:on_progress,:on_header,:on_body,:on_complete,:on_success])
151
151
  end
152
152
 
153
153
  it "should call callbacks in correct order on failed request" do
@@ -162,7 +162,7 @@ unless RUBY_PLATFORM =~ /java/
162
162
  @curl.on_progress {|*args| order << :on_progress }
163
163
  @curl.http_get
164
164
 
165
- order.should == [:on_progress,:on_header,:on_body,:on_complete,:on_failure]
165
+ expect(order).to eq([:on_progress,:on_header,:on_body,:on_complete,:on_failure])
166
166
  end
167
167
 
168
168
  it "should call callbacks in correct order on missing request" do
@@ -177,7 +177,7 @@ unless RUBY_PLATFORM =~ /java/
177
177
  @curl.on_progress {|*args| order << :on_progress }
178
178
  @curl.http_get
179
179
 
180
- order.should == [:on_progress,:on_header,:on_body,:on_complete,:on_missing]
180
+ expect(order).to eq([:on_progress,:on_header,:on_body,:on_complete,:on_missing])
181
181
  end
182
182
  end
183
183
 
@@ -197,7 +197,7 @@ unless RUBY_PLATFORM =~ /java/
197
197
  :headers => { 'Location' => 'http://www.example.com' })
198
198
 
199
199
  @curl.http_get
200
- @curl.last_effective_url.should == 'http://example.com'
200
+ expect(@curl.last_effective_url).to eq('http://example.com')
201
201
  end
202
202
  end
203
203
 
@@ -207,7 +207,7 @@ unless RUBY_PLATFORM =~ /java/
207
207
  it 'should be the same as #url when no location header is present' do
208
208
  stub_request(:any, "example.com")
209
209
  @curl.http_get
210
- @curl.last_effective_url.should == 'http://example.com'
210
+ expect(@curl.last_effective_url).to eq('http://example.com')
211
211
  end
212
212
 
213
213
  it 'should be the value of the location header when present' do
@@ -216,7 +216,7 @@ unless RUBY_PLATFORM =~ /java/
216
216
  stub_request(:any, 'www.example.com')
217
217
 
218
218
  @curl.http_get
219
- @curl.last_effective_url.should == 'http://www.example.com'
219
+ expect(@curl.last_effective_url).to eq('http://www.example.com')
220
220
  end
221
221
 
222
222
  it 'should work with more than one redirect' do
@@ -227,7 +227,7 @@ unless RUBY_PLATFORM =~ /java/
227
227
  stub_request(:any, 'blog.example.com')
228
228
 
229
229
  @curl.http_get
230
- @curl.last_effective_url.should == 'http://blog.example.com'
230
+ expect(@curl.last_effective_url).to eq('http://blog.example.com')
231
231
  end
232
232
 
233
233
  it 'should maintain the original url' do
@@ -236,7 +236,7 @@ unless RUBY_PLATFORM =~ /java/
236
236
  stub_request(:any, 'www.example.com')
237
237
 
238
238
  @curl.http_get
239
- @curl.url.should == 'http://example.com'
239
+ expect(@curl.url).to eq('http://example.com')
240
240
  end
241
241
 
242
242
  it 'should have the redirected-to attrs (body, response code)' do
@@ -247,8 +247,8 @@ unless RUBY_PLATFORM =~ /java/
247
247
  stub_request(:any, 'www.example.com').to_return(:body => 'request B')
248
248
 
249
249
  @curl.http_get
250
- @curl.body_str.should == 'request B'
251
- @curl.response_code.should == 200
250
+ expect(@curl.body_str).to eq('request B')
251
+ expect(@curl.response_code).to eq(200)
252
252
  end
253
253
 
254
254
  it 'should follow more than one redirect' do
@@ -259,8 +259,8 @@ unless RUBY_PLATFORM =~ /java/
259
259
  stub_request(:any, 'blog.example.com').to_return(:body => 'blog post')
260
260
 
261
261
  @curl.http_get
262
- @curl.url.should == 'http://example.com'
263
- @curl.body_str.should == 'blog post'
262
+ expect(@curl.url).to eq('http://example.com')
263
+ expect(@curl.body_str).to eq('blog post')
264
264
  end
265
265
  end
266
266
  end
@@ -281,7 +281,7 @@ unless RUBY_PLATFORM =~ /java/
281
281
  :headers => { 'Content-Type' => content_type })
282
282
 
283
283
  @curl.http_get
284
- @curl.content_type.should == content_type
284
+ expect(@curl.content_type).to eq(content_type)
285
285
  end
286
286
  end
287
287
 
@@ -294,7 +294,7 @@ unless RUBY_PLATFORM =~ /java/
294
294
  :status => 200 )
295
295
 
296
296
  @curl.http_get
297
- @curl.content_type.should be_nil
297
+ expect(@curl.content_type).to be_nil
298
298
  end
299
299
  end
300
300
  end
@@ -312,7 +312,7 @@ unless RUBY_PLATFORM =~ /java/
312
312
  :headers => { 'Transfer-Encoding' => 'chunked' })
313
313
 
314
314
  @curl.http_get
315
- @curl.should be_chunked_response
315
+ expect(@curl).to be_chunked_response
316
316
  end
317
317
 
318
318
  it "is false when Transfer-Encoding is not 'chunked'" do
@@ -321,7 +321,7 @@ unless RUBY_PLATFORM =~ /java/
321
321
  :status => 200)
322
322
 
323
323
  @curl.http_get
324
- @curl.should_not be_chunked_response
324
+ expect(@curl).not_to be_chunked_response
325
325
  end
326
326
 
327
327
  it "is false when Transfer-Encoding is 'chunked' but body does not respond to each" do
@@ -330,7 +330,7 @@ unless RUBY_PLATFORM =~ /java/
330
330
  :status => 200)
331
331
 
332
332
  @curl.http_get
333
- @curl.should_not be_chunked_response
333
+ expect(@curl).not_to be_chunked_response
334
334
  end
335
335
  end
336
336
  end
@@ -346,7 +346,7 @@ unless RUBY_PLATFORM =~ /java/
346
346
  c = Curl::Easy.new
347
347
  c.url = "http://www.example.com"
348
348
  c.http(:GET)
349
- c.body_str.should == "abc"
349
+ expect(c.body_str).to eq("abc")
350
350
  end
351
351
 
352
352
  it "should alias body to body_str" do
@@ -355,7 +355,7 @@ unless RUBY_PLATFORM =~ /java/
355
355
  c = Curl::Easy.new
356
356
  c.url = "http://www.example.com"
357
357
  c.http(:GET)
358
- c.body.should == "abc"
358
+ expect(c.body).to eq("abc")
359
359
  end
360
360
  end
361
361
 
@@ -369,13 +369,13 @@ unless RUBY_PLATFORM =~ /java/
369
369
  c.url = "http://www.example.com"
370
370
  c.post_body = "01234"
371
371
  c.http_post
372
- c.response_code.should == 200
372
+ expect(c.response_code).to eq(200)
373
373
  end
374
374
 
375
375
  it "should work with several body arguments for post using the class method" do
376
376
  stub_request(:post, "www.example.com").with(:body => {:user => {:first_name=>'Bartosz', :last_name=>'Blimke'}})
377
377
  c = Curl::Easy.http_post "http://www.example.com", 'user[first_name]=Bartosz', 'user[last_name]=Blimke'
378
- c.response_code.should == 200
378
+ expect(c.response_code).to eq(200)
379
379
  end
380
380
 
381
381
  it "should work with blank arguments for put" do
@@ -384,7 +384,7 @@ unless RUBY_PLATFORM =~ /java/
384
384
  c.url = "http://www.example.com"
385
385
  c.put_data = "01234"
386
386
  c.http_put
387
- c.response_code.should == 200
387
+ expect(c.response_code).to eq(200)
388
388
  end
389
389
 
390
390
  it "should work with multiple arguments for post" do
@@ -395,7 +395,7 @@ unless RUBY_PLATFORM =~ /java/
395
395
  c.url = "http://www.example.com"
396
396
  c.http_post Curl::PostField.content('name', data[:name]), Curl::PostField.content('address', data[:address])
397
397
 
398
- c.response_code.should == 200
398
+ expect(c.response_code).to eq(200)
399
399
  end
400
400
 
401
401
  end
@@ -33,7 +33,7 @@ unless RUBY_PLATFORM =~ /java/
33
33
 
34
34
  make_request
35
35
 
36
- urls.should eq([http_url, https_url])
36
+ expect(urls).to eq([http_url, https_url])
37
37
  end
38
38
 
39
39
  it 'invokes the after_request hook with both requests' do
@@ -42,7 +42,7 @@ unless RUBY_PLATFORM =~ /java/
42
42
 
43
43
  make_request
44
44
 
45
- urls.should eq([http_url, https_url])
45
+ expect(urls).to eq([http_url, https_url])
46
46
  end
47
47
  end
48
48
 
@@ -65,7 +65,7 @@ unless RUBY_PLATFORM =~ /java/
65
65
  http = conn.get(:body => 'foo')
66
66
 
67
67
  http.callback do
68
- WebMock.should have_requested(:get, "www.example.com").with(:body => 'bar')
68
+ expect(WebMock).to have_requested(:get, "www.example.com").with(:body => 'bar')
69
69
  EM.stop
70
70
  end
71
71
  end
@@ -90,7 +90,7 @@ unless RUBY_PLATFORM =~ /java/
90
90
  http = conn.get
91
91
 
92
92
  http.callback do
93
- http.response.should be == 'bar'
93
+ expect(http.response).to eq('bar')
94
94
  EM.stop
95
95
  end
96
96
  end
@@ -112,7 +112,7 @@ unless RUBY_PLATFORM =~ /java/
112
112
  http.callback { EM.stop }
113
113
  end
114
114
 
115
- yielded_response_body.should eq("hello world")
115
+ expect(yielded_response_body).to eq("hello world")
116
116
  end
117
117
  end
118
118
 
@@ -138,10 +138,10 @@ unless RUBY_PLATFORM =~ /java/
138
138
  called = true
139
139
  EM.stop
140
140
  end
141
- called.should == false
141
+ expect(called).to eq(false)
142
142
  end
143
143
 
144
- called.should == true
144
+ expect(called).to eq(true)
145
145
  end
146
146
 
147
147
  # not pretty, but it works
@@ -161,7 +161,7 @@ unless RUBY_PLATFORM =~ /java/
161
161
 
162
162
  it "should work" do
163
163
  stub_request(:post, /.*.testserver.com*/).to_return(:status => 200, :body => 'ok')
164
- lambda {
164
+ expect {
165
165
  EM.run do
166
166
  fiber = Fiber.new do
167
167
  http = EM::HttpRequest.new("http://www.testserver.com").post :body => "foo=bar&baz=bang", :timeout => 60
@@ -169,7 +169,7 @@ unless RUBY_PLATFORM =~ /java/
169
169
  end
170
170
  fiber.resume
171
171
  end
172
- }.should_not raise_error
172
+ }.not_to raise_error
173
173
  end
174
174
 
175
175
  after(:each) do
@@ -193,40 +193,40 @@ unless RUBY_PLATFORM =~ /java/
193
193
  http = EventMachine::HttpRequest.new('http://www.example.com/').get
194
194
  http.stream { |chunk| response = chunk; EM.stop }
195
195
  }
196
- response.should == "abc"
196
+ expect(response).to eq("abc")
197
197
  end
198
198
 
199
199
  it "should work with responses that use chunked transfer encoding" do
200
200
  stub_request(:get, "www.example.com").to_return(:body => "abc", :headers => { 'Transfer-Encoding' => 'chunked' })
201
- http_request(:get, "http://www.example.com").body.should == "abc"
201
+ expect(http_request(:get, "http://www.example.com").body).to eq("abc")
202
202
  end
203
203
 
204
204
  it "should work with optional query params" do
205
205
  stub_request(:get, "www.example.com/?x=3&a[]=b&a[]=c").to_return(:body => "abc")
206
- http_request(:get, "http://www.example.com/?x=3", :query => {"a" => ["b", "c"]}).body.should == "abc"
206
+ expect(http_request(:get, "http://www.example.com/?x=3", :query => {"a" => ["b", "c"]}).body).to eq("abc")
207
207
  end
208
208
 
209
209
  it "should work with optional query params declared as string" do
210
210
  stub_request(:get, "www.example.com/?x=3&a[]=b&a[]=c").to_return(:body => "abc")
211
- http_request(:get, "http://www.example.com/?x=3", :query => "a[]=b&a[]=c").body.should == "abc"
211
+ expect(http_request(:get, "http://www.example.com/?x=3", :query => "a[]=b&a[]=c").body).to eq("abc")
212
212
  end
213
213
 
214
214
  it "should work when the body is passed as a Hash" do
215
215
  stub_request(:post, "www.example.com").with(:body => {:a => "1", :b => "2"}).to_return(:body => "ok")
216
- http_request(:post, "http://www.example.com", :body => {:a => "1", :b => "2"}).body.should == "ok"
216
+ expect(http_request(:post, "http://www.example.com", :body => {:a => "1", :b => "2"}).body).to eq("ok")
217
217
  end
218
218
 
219
219
  if defined?(EventMachine::HttpConnection)
220
220
  it "should work when a file is passed as body" do
221
221
  stub_request(:post, "www.example.com").with(:body => File.read(__FILE__)).to_return(:body => "ok")
222
- http_request(:post, "http://www.example.com", :file => __FILE__).body.should == "ok"
222
+ expect(http_request(:post, "http://www.example.com", :file => __FILE__).body).to eq("ok")
223
223
  end
224
224
  end
225
225
 
226
226
  it "should work with UTF-8 strings" do
227
227
  body = "Привет, Мир!"
228
228
  stub_request(:post, "www.example.com").to_return(:body => body)
229
- http_request(:post, "http://www.example.com").body.bytesize.should == body.bytesize
229
+ expect(http_request(:post, "http://www.example.com").body.bytesize).to eq(body.bytesize)
230
230
  end
231
231
 
232
232
  describe "mocking EM::HttpClient API" do
@@ -250,11 +250,11 @@ unless RUBY_PLATFORM =~ /java/
250
250
  subject { client(uri) }
251
251
 
252
252
  it 'should support #uri' do
253
- subject.uri.should == Addressable::URI.parse(uri)
253
+ expect(subject.uri).to eq(Addressable::URI.parse(uri))
254
254
  end
255
255
 
256
256
  it 'should support #last_effective_url' do
257
- subject.last_effective_url.should == Addressable::URI.parse(uri)
257
+ expect(subject.last_effective_url).to eq(Addressable::URI.parse(uri))
258
258
  end
259
259
 
260
260
  context "with a query" do
@@ -262,9 +262,9 @@ unless RUBY_PLATFORM =~ /java/
262
262
  subject { client("http://www.example.com/?a=1", :query => { 'b' => 2 }) }
263
263
 
264
264
  it "#request_signature doesn't mutate the original uri" do
265
- subject.uri.should == Addressable::URI.parse("http://www.example.com/?a=1")
265
+ expect(subject.uri).to eq(Addressable::URI.parse("http://www.example.com/?a=1"))
266
266
  signature = WebMock::RequestRegistry.instance.requested_signatures.hash.keys.first
267
- signature.uri.should == Addressable::URI.parse(uri)
267
+ expect(signature.uri).to eq(Addressable::URI.parse(uri))
268
268
  end
269
269
  end
270
270
 
@@ -293,7 +293,7 @@ unless RUBY_PLATFORM =~ /java/
293
293
 
294
294
  http.errback { fail(http.error) }
295
295
  http.callback {
296
- http.get_response_cookie(cookie_name).should == cookie_value
296
+ expect(http.get_response_cookie(cookie_name)).to eq(cookie_value)
297
297
  EM.stop
298
298
  }
299
299
  }
@@ -314,8 +314,8 @@ unless RUBY_PLATFORM =~ /java/
314
314
 
315
315
  http.errback { fail(http.error) }
316
316
  http.callback {
317
- http.get_response_cookie(cookie_name).should == cookie_value
318
- http.get_response_cookie(cookie_2_name).should == cookie_2_value
317
+ expect(http.get_response_cookie(cookie_name)).to eq(cookie_value)
318
+ expect(http.get_response_cookie(cookie_2_name)).to eq(cookie_2_value)
319
319
  EM.stop
320
320
  }
321
321
  }
@@ -333,7 +333,7 @@ unless RUBY_PLATFORM =~ /java/
333
333
 
334
334
  http.errback { fail(http.error) }
335
335
  http.callback {
336
- http.get_response_cookie('not_found_cookie').should == nil
336
+ expect(http.get_response_cookie('not_found_cookie')).to eq(nil)
337
337
  EM.stop
338
338
  }
339
339
  }