webmock 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/Gemfile +2 -7
  4. data/README.md +54 -53
  5. data/Rakefile +1 -1
  6. data/lib/webmock/callback_registry.rb +1 -1
  7. data/lib/webmock/http_lib_adapters/curb_adapter.rb +68 -6
  8. data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +4 -4
  9. data/lib/webmock/http_lib_adapters/excon_adapter.rb +9 -9
  10. data/lib/webmock/http_lib_adapters/http_rb/request.rb +2 -2
  11. data/lib/webmock/http_lib_adapters/http_rb/response.rb +5 -5
  12. data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +3 -3
  13. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +5 -5
  14. data/lib/webmock/http_lib_adapters/manticore_adapter.rb +7 -7
  15. data/lib/webmock/http_lib_adapters/net_http.rb +3 -3
  16. data/lib/webmock/http_lib_adapters/patron_adapter.rb +4 -4
  17. data/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +14 -14
  18. data/lib/webmock/matchers/hash_including_matcher.rb +1 -1
  19. data/lib/webmock/rack_response.rb +3 -3
  20. data/lib/webmock/request_pattern.rb +8 -8
  21. data/lib/webmock/request_stub.rb +5 -5
  22. data/lib/webmock/util/uri.rb +2 -2
  23. data/lib/webmock/version.rb +1 -1
  24. data/minitest/webmock_spec.rb +3 -3
  25. data/spec/acceptance/curb/curb_spec.rb +64 -47
  26. data/spec/acceptance/curb/curb_spec_helper.rb +4 -4
  27. data/spec/acceptance/em_http_request/em_http_request_spec.rb +32 -32
  28. data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +9 -9
  29. data/spec/acceptance/excon/excon_spec.rb +14 -14
  30. data/spec/acceptance/excon/excon_spec_helper.rb +6 -6
  31. data/spec/acceptance/http_rb/http_rb_spec.rb +1 -1
  32. data/spec/acceptance/http_rb/http_rb_spec_helper.rb +7 -7
  33. data/spec/acceptance/httpclient/httpclient_spec.rb +20 -20
  34. data/spec/acceptance/httpclient/httpclient_spec_helper.rb +5 -5
  35. data/spec/acceptance/manticore/manticore_spec.rb +11 -11
  36. data/spec/acceptance/manticore/manticore_spec_helper.rb +3 -3
  37. data/spec/acceptance/net_http/net_http_shared.rb +4 -4
  38. data/spec/acceptance/net_http/net_http_spec.rb +25 -25
  39. data/spec/acceptance/net_http/net_http_spec_helper.rb +4 -4
  40. data/spec/acceptance/net_http/real_net_http_spec.rb +1 -1
  41. data/spec/acceptance/patron/patron_spec.rb +10 -10
  42. data/spec/acceptance/patron/patron_spec_helper.rb +5 -5
  43. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +36 -36
  44. data/spec/acceptance/shared/callbacks.rb +11 -11
  45. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +5 -5
  46. data/spec/acceptance/shared/enabling_and_disabling_webmock.rb +4 -4
  47. data/spec/acceptance/shared/precedence_of_stubs.rb +4 -4
  48. data/spec/acceptance/shared/request_expectations.rb +90 -90
  49. data/spec/acceptance/shared/returning_declared_responses.rb +49 -49
  50. data/spec/acceptance/shared/stubbing_requests.rb +78 -78
  51. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +11 -11
  52. data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +8 -8
  53. data/spec/spec_helper.rb +6 -3
  54. data/spec/support/webmock_server.rb +1 -1
  55. data/spec/unit/api_spec.rb +2 -2
  56. data/spec/unit/errors_spec.rb +3 -3
  57. data/spec/unit/matchers/hash_including_matcher_spec.rb +16 -16
  58. data/spec/unit/rack_response_spec.rb +2 -2
  59. data/spec/unit/request_body_diff_spec.rb +1 -1
  60. data/spec/unit/request_execution_verifier_spec.rb +1 -1
  61. data/spec/unit/request_pattern_spec.rb +115 -115
  62. data/spec/unit/request_signature_snippet_spec.rb +2 -2
  63. data/spec/unit/request_signature_spec.rb +16 -16
  64. data/spec/unit/request_stub_spec.rb +20 -20
  65. data/spec/unit/response_spec.rb +28 -28
  66. data/spec/unit/stub_registry_spec.rb +10 -10
  67. data/spec/unit/stub_request_snippet_spec.rb +6 -6
  68. data/spec/unit/util/hash_keys_stringifier_spec.rb +4 -4
  69. data/spec/unit/util/query_mapper_spec.rb +2 -2
  70. data/spec/unit/util/uri_spec.rb +1 -1
  71. data/test/http_request.rb +3 -3
  72. data/test/shared_test.rb +6 -6
  73. data/webmock.gemspec +4 -2
  74. metadata +32 -4
@@ -103,7 +103,7 @@ if defined?(EventMachine::HttpClient)
103
103
  WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
104
104
 
105
105
  if stubbed_webmock_response
106
- WebMock::CallbackRegistry.invoke_callbacks({:lib => :em_http_request}, request_signature, stubbed_webmock_response)
106
+ WebMock::CallbackRegistry.invoke_callbacks({lib: :em_http_request}, request_signature, stubbed_webmock_response)
107
107
  @uri ||= nil
108
108
  EM.next_tick {
109
109
  setup(make_raw_response(stubbed_webmock_response), @uri,
@@ -121,7 +121,7 @@ if defined?(EventMachine::HttpClient)
121
121
  if !stubbed_webmock_response && WebMock::CallbackRegistry.any_callbacks?
122
122
  webmock_response = build_webmock_response
123
123
  WebMock::CallbackRegistry.invoke_callbacks(
124
- {:lib => :em_http_request, :real_request => true},
124
+ {lib: :em_http_request, real_request: true},
125
125
  request_signature,
126
126
  webmock_response)
127
127
  end
@@ -187,8 +187,8 @@ if defined?(EventMachine::HttpClient)
187
187
  WebMock::RequestSignature.new(
188
188
  method.downcase.to_sym,
189
189
  uri.to_s,
190
- :body => body || (@req.file && File.read(@req.file)),
191
- :headers => headers
190
+ body: body || (@req.file && File.read(@req.file)),
191
+ headers: headers
192
192
  )
193
193
  end
194
194
 
@@ -54,14 +54,14 @@ if defined?(Excon)
54
54
  WebMock::RequestRegistry.instance.requested_signatures.put(mock_request)
55
55
 
56
56
  if mock_response = WebMock::StubRegistry.instance.response_for_request(mock_request)
57
- self.perform_callbacks(mock_request, mock_response, :real_request => false)
57
+ self.perform_callbacks(mock_request, mock_response, real_request: false)
58
58
  response = self.real_response(mock_response)
59
59
  response
60
60
  elsif WebMock.net_connect_allowed?(mock_request.uri)
61
61
  conn = new_excon_connection(params)
62
- real_response = conn.request(request_params_from(params.merge(:mock => false)))
62
+ real_response = conn.request(request_params_from(params.merge(mock: false)))
63
63
 
64
- ExconAdapter.perform_callbacks(mock_request, ExconAdapter.mock_response(real_response), :real_request => true)
64
+ ExconAdapter.perform_callbacks(mock_request, ExconAdapter.mock_response(real_response), real_request: true)
65
65
 
66
66
  real_response.data
67
67
  else
@@ -73,7 +73,7 @@ if defined?(Excon)
73
73
  # Ensure the connection is constructed with the exact same args
74
74
  # that the orginal connection was constructed with.
75
75
  args = params.fetch(:__construction_args)
76
- ::Excon::Connection.new(connection_params_from args.merge(:mock => false))
76
+ ::Excon::Connection.new(connection_params_from args.merge(mock: false))
77
77
  end
78
78
 
79
79
  def self.connection_params_from(hash)
@@ -112,7 +112,7 @@ if defined?(Excon)
112
112
  method = (params.delete(:method) || :get).to_s.downcase.to_sym
113
113
  params[:query] = to_query(params[:query]) if params[:query].is_a?(Hash)
114
114
  uri = Addressable::URI.new(params).to_s
115
- WebMock::RequestSignature.new method, uri, :body => body_from(params), :headers => params[:headers]
115
+ WebMock::RequestSignature.new method, uri, body: body_from(params), headers: params[:headers]
116
116
  end
117
117
 
118
118
  def self.body_from(params)
@@ -128,9 +128,9 @@ if defined?(Excon)
128
128
  raise Excon::Errors::Timeout if mock.should_timeout
129
129
  mock.raise_error_if_any
130
130
  {
131
- :body => mock.body,
132
- :status => mock.status[0].to_i,
133
- :headers => mock.headers || {}
131
+ body: mock.body,
132
+ status: mock.status[0].to_i,
133
+ headers: mock.headers || {}
134
134
  }
135
135
  end
136
136
 
@@ -144,7 +144,7 @@ if defined?(Excon)
144
144
 
145
145
  def self.perform_callbacks(request, response, options = {})
146
146
  return unless WebMock::CallbackRegistry.any_callbacks?
147
- WebMock::CallbackRegistry.invoke_callbacks(options.merge(:lib => :excon), request, response)
147
+ WebMock::CallbackRegistry.invoke_callbacks(options.merge(lib: :excon), request, response)
148
148
  end
149
149
  end
150
150
  end
@@ -2,8 +2,8 @@ module HTTP
2
2
  class Request
3
3
  def webmock_signature
4
4
  ::WebMock::RequestSignature.new(verb, uri.to_s, {
5
- :headers => headers.to_h,
6
- :body => body
5
+ headers: headers.to_h,
6
+ body: body
7
7
  })
8
8
  end
9
9
  end
@@ -20,11 +20,11 @@ module HTTP
20
20
  return new(status, "1.1", headers, body, uri) if HTTP::VERSION < "1.0.0"
21
21
 
22
22
  new({
23
- :status => status,
24
- :version => "1.1",
25
- :headers => headers,
26
- :body => body,
27
- :uri => uri
23
+ status: status,
24
+ version: "1.1",
25
+ headers: headers,
26
+ body: body,
27
+ uri: uri
28
28
  })
29
29
  end
30
30
 
@@ -37,7 +37,7 @@ module HTTP
37
37
  raise_timeout_error if webmock_response.should_timeout
38
38
  webmock_response.raise_error_if_any
39
39
 
40
- invoke_callbacks(webmock_response, :real_request => false)
40
+ invoke_callbacks(webmock_response, real_request: false)
41
41
  ::HTTP::Response.from_webmock webmock_response, request_signature
42
42
  end
43
43
 
@@ -49,7 +49,7 @@ module HTTP
49
49
  def perform
50
50
  return unless ::WebMock.net_connect_allowed?(request_signature.uri)
51
51
  response = @perform.call
52
- invoke_callbacks(response.to_webmock, :real_request => true)
52
+ invoke_callbacks(response.to_webmock, real_request: true)
53
53
  response
54
54
  end
55
55
 
@@ -59,7 +59,7 @@ module HTTP
59
59
 
60
60
  def invoke_callbacks(webmock_response, options = {})
61
61
  ::WebMock::CallbackRegistry.invoke_callbacks(
62
- options.merge({ :lib => :http_rb }),
62
+ options.merge({ lib: :http_rb }),
63
63
  request_signature,
64
64
  webmock_response
65
65
  )
@@ -64,7 +64,7 @@ if defined?(::HTTPClient)
64
64
  end
65
65
  res = conn.push(response)
66
66
  WebMock::CallbackRegistry.invoke_callbacks(
67
- {:lib => :httpclient}, request_signature, webmock_response)
67
+ {lib: :httpclient}, request_signature, webmock_response)
68
68
  res
69
69
  elsif WebMock.net_connect_allowed?(request_signature.uri)
70
70
  # in case there is a nil entry in the hash...
@@ -86,7 +86,7 @@ if defined?(::HTTPClient)
86
86
  if WebMock::CallbackRegistry.any_callbacks?
87
87
  webmock_response = build_webmock_response(res, body)
88
88
  WebMock::CallbackRegistry.invoke_callbacks(
89
- {:lib => :httpclient, :real_request => true}, request_signature,
89
+ {lib: :httpclient, real_request: true}, request_signature,
90
90
  webmock_response)
91
91
  end
92
92
  res
@@ -168,7 +168,7 @@ if defined?(::HTTPClient)
168
168
 
169
169
  def build_request_signature(req, reuse_existing = false)
170
170
  uri = WebMock::Util::URI.heuristic_parse(req.header.request_uri.to_s)
171
- uri.query = WebMock::Util::QueryMapper.values_to_query(req.header.request_query, :notation => WebMock::Config.instance.query_values_notation) if req.header.request_query
171
+ uri.query = WebMock::Util::QueryMapper.values_to_query(req.header.request_query, notation: WebMock::Config.instance.query_values_notation) if req.header.request_query
172
172
  uri.port = req.header.request_uri.port
173
173
 
174
174
  @request_filter.each do |filter|
@@ -185,8 +185,8 @@ if defined?(::HTTPClient)
185
185
  signature = WebMock::RequestSignature.new(
186
186
  req.header.request_method.downcase.to_sym,
187
187
  uri.to_s,
188
- :body => req.http_body.dump,
189
- :headers => headers
188
+ body: req.http_body.dump,
189
+ headers: headers
190
190
  )
191
191
 
192
192
  # reuse a previous identical signature object if we stored one for later use
@@ -34,7 +34,7 @@ if defined?(Manticore)
34
34
  def format_options(options)
35
35
  return options unless headers = options[:headers]
36
36
 
37
- options.merge(:headers => join_array_values(headers))
37
+ options.merge(headers: join_array_values(headers))
38
38
  end
39
39
 
40
40
  def join_array_values(headers)
@@ -62,7 +62,7 @@ if defined?(Manticore)
62
62
  raise WebMock::NetConnectNotAllowedError.new(request_signature)
63
63
  end
64
64
 
65
- WebMock::CallbackRegistry.invoke_callbacks({:lib => :manticore, :real_request => real_request}, request_signature, webmock_response)
65
+ WebMock::CallbackRegistry.invoke_callbacks({lib: :manticore, real_request: real_request}, request_signature, webmock_response)
66
66
  manticore_response
67
67
  end
68
68
 
@@ -84,7 +84,7 @@ if defined?(Manticore)
84
84
  headers['Authorization'] = WebMock::Util::Headers.basic_auth_header(credentials.get_user_name,credentials.get_password)
85
85
  end
86
86
 
87
- WebMock::RequestSignature.new(method, uri, {:body => body, :headers => headers})
87
+ WebMock::RequestSignature.new(method, uri, {body: body, headers: headers})
88
88
  end
89
89
 
90
90
  def read_body(request)
@@ -106,10 +106,10 @@ if defined?(Manticore)
106
106
  raise Manticore::ConnectTimeout if webmock_response.should_timeout
107
107
 
108
108
  Manticore::StubbedResponse.stub(
109
- :code => webmock_response.status[0],
110
- :body => webmock_response.body,
111
- :headers => webmock_response.headers,
112
- :cookies => {}
109
+ code: webmock_response.status[0],
110
+ body: webmock_response.body,
111
+ headers: webmock_response.headers,
112
+ cookies: {}
113
113
  )
114
114
  end
115
115
 
@@ -79,7 +79,7 @@ module WebMock
79
79
  if webmock_response = WebMock::StubRegistry.instance.response_for_request(request_signature)
80
80
  @socket = Net::HTTP.socket_type.new
81
81
  WebMock::CallbackRegistry.invoke_callbacks(
82
- {:lib => :net_http}, request_signature, webmock_response)
82
+ {lib: :net_http}, request_signature, webmock_response)
83
83
  build_net_http_response(webmock_response, &block)
84
84
  elsif WebMock.net_connect_allowed?(request_signature.uri)
85
85
  check_right_http_connection
@@ -87,7 +87,7 @@ module WebMock
87
87
  if WebMock::CallbackRegistry.any_callbacks?
88
88
  webmock_response = build_webmock_response(response)
89
89
  WebMock::CallbackRegistry.invoke_callbacks(
90
- {:lib => :net_http, :real_request => true}, request_signature, webmock_response)
90
+ {lib: :net_http, real_request: true}, request_signature, webmock_response)
91
91
  end
92
92
  response.extend Net::WebMockHTTPResponse
93
93
  block.call response if block
@@ -292,7 +292,7 @@ module WebMock
292
292
  request.set_body_internal body
293
293
  end
294
294
 
295
- WebMock::RequestSignature.new(method, uri, :body => request.body, :headers => headers)
295
+ WebMock::RequestSignature.new(method, uri, body: request.body, headers: headers)
296
296
  end
297
297
 
298
298
  def self.validate_headers(headers)
@@ -25,7 +25,7 @@ if defined?(::Patron)
25
25
  res = WebMock::HttpLibAdapters::PatronAdapter.
26
26
  build_patron_response(webmock_response, default_response_charset)
27
27
  WebMock::CallbackRegistry.invoke_callbacks(
28
- {:lib => :patron}, request_signature, webmock_response)
28
+ {lib: :patron}, request_signature, webmock_response)
29
29
  res
30
30
  elsif WebMock.net_connect_allowed?(request_signature.uri)
31
31
  res = super
@@ -33,7 +33,7 @@ if defined?(::Patron)
33
33
  webmock_response = WebMock::HttpLibAdapters::PatronAdapter.
34
34
  build_webmock_response(res)
35
35
  WebMock::CallbackRegistry.invoke_callbacks(
36
- {:lib => :patron, :real_request => true}, request_signature,
36
+ {lib: :patron, real_request: true}, request_signature,
37
37
  webmock_response)
38
38
  end
39
39
  res
@@ -91,8 +91,8 @@ if defined?(::Patron)
91
91
  request_signature = WebMock::RequestSignature.new(
92
92
  req.action,
93
93
  uri.to_s,
94
- :body => request_body,
95
- :headers => headers
94
+ body: request_body,
95
+ headers: headers
96
96
  )
97
97
  request_signature
98
98
  end
@@ -69,8 +69,8 @@ if defined?(Typhoeus)
69
69
  request_signature = WebMock::RequestSignature.new(
70
70
  req.options[:method] || :get,
71
71
  uri.to_s,
72
- :body => body,
73
- :headers => headers
72
+ body: body,
73
+ headers: headers
74
74
  )
75
75
 
76
76
  req.instance_variable_set(:@__webmock_request_signature, request_signature)
@@ -90,19 +90,19 @@ if defined?(Typhoeus)
90
90
  def self.generate_typhoeus_response(request_signature, webmock_response)
91
91
  response = if webmock_response.should_timeout
92
92
  ::Typhoeus::Response.new(
93
- :code => 0,
94
- :status_message => "",
95
- :body => "",
96
- :headers => {},
97
- :return_code => :operation_timedout
93
+ code: 0,
94
+ status_message: "",
95
+ body: "",
96
+ headers: {},
97
+ return_code: :operation_timedout
98
98
  )
99
99
  else
100
100
  ::Typhoeus::Response.new(
101
- :code => webmock_response.status[0],
102
- :status_message => webmock_response.status[1],
103
- :body => webmock_response.body,
104
- :headers => webmock_response.headers,
105
- :effective_url => request_signature.uri
101
+ code: webmock_response.status[0],
102
+ status_message: webmock_response.status[1],
103
+ body: webmock_response.body,
104
+ headers: webmock_response.headers,
105
+ effective_url: request_signature.uri
106
106
  )
107
107
  end
108
108
  response.mock = :webmock
@@ -126,13 +126,13 @@ if defined?(Typhoeus)
126
126
  build_webmock_response(response)
127
127
  if response.mock
128
128
  WebMock::CallbackRegistry.invoke_callbacks(
129
- {:lib => :typhoeus},
129
+ {lib: :typhoeus},
130
130
  request_signature,
131
131
  webmock_response
132
132
  )
133
133
  else
134
134
  WebMock::CallbackRegistry.invoke_callbacks(
135
- {:lib => :typhoeus, :real_request => true},
135
+ {lib: :typhoeus, real_request: true},
136
136
  request_signature,
137
137
  webmock_response
138
138
  )
@@ -4,7 +4,7 @@ module WebMock
4
4
  #https://github.com/rspec/rspec-mocks/blob/master/lib/rspec/mocks/argument_matchers.rb
5
5
  class HashIncludingMatcher
6
6
  def initialize(expected)
7
- @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, :deep => true).sort]
7
+ @expected = Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(expected, deep: true).sort]
8
8
  end
9
9
 
10
10
  def ==(actual)
@@ -10,9 +10,9 @@ module WebMock
10
10
  status, headers, response = @app.call(env)
11
11
 
12
12
  Response.new(
13
- :body => body_from_rack_response(response),
14
- :headers => headers,
15
- :status => status
13
+ body: body_from_rack_response(response),
14
+ headers: headers,
15
+ status: status
16
16
  )
17
17
  end
18
18
 
@@ -49,7 +49,7 @@ module WebMock
49
49
 
50
50
 
51
51
  def assign_options(options)
52
- options = WebMock::Util::HashKeysStringifier.stringify_keys!(options, :deep => true)
52
+ options = WebMock::Util::HashKeysStringifier.stringify_keys!(options, deep: true)
53
53
  HashValidator.new(options).validate_keys('body', 'headers', 'query', 'basic_auth')
54
54
  set_basic_auth_as_headers!(options)
55
55
  @body_pattern = BodyPattern.new(options['body']) if options.has_key?('body')
@@ -120,7 +120,7 @@ module WebMock
120
120
  elsif rSpecHashIncludingMatcher?(query_params)
121
121
  WebMock::Matchers::HashIncludingMatcher.from_rspec_matcher(query_params)
122
122
  else
123
- WebMock::Util::QueryMapper.query_to_values(query_params, :notation => Config.instance.query_values_notation)
123
+ WebMock::Util::QueryMapper.query_to_values(query_params, notation: Config.instance.query_values_notation)
124
124
  end
125
125
  end
126
126
 
@@ -134,7 +134,7 @@ module WebMock
134
134
  class URIRegexpPattern < URIPattern
135
135
  def matches?(uri)
136
136
  WebMock::Util::URI.variations_of_uri_as_strings(uri).any? { |u| u.match(@pattern) } &&
137
- (@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, :notation => Config.instance.query_values_notation))
137
+ (@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, notation: Config.instance.query_values_notation))
138
138
  end
139
139
 
140
140
  def to_s
@@ -173,7 +173,7 @@ module WebMock
173
173
  if @pattern.is_a?(Addressable::URI)
174
174
  if @query_params
175
175
  uri.omit(:query) === @pattern &&
176
- (@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, :notation => Config.instance.query_values_notation))
176
+ (@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, notation: Config.instance.query_values_notation))
177
177
  else
178
178
  uri === @pattern
179
179
  end
@@ -185,8 +185,8 @@ module WebMock
185
185
  def add_query_params(query_params)
186
186
  super
187
187
  if @query_params.is_a?(Hash) || @query_params.is_a?(String)
188
- query_hash = (WebMock::Util::QueryMapper.query_to_values(@pattern.query, :notation => Config.instance.query_values_notation) || {}).merge(@query_params)
189
- @pattern.query = WebMock::Util::QueryMapper.values_to_query(query_hash, :notation => WebMock::Config.instance.query_values_notation)
188
+ query_hash = (WebMock::Util::QueryMapper.query_to_values(@pattern.query, notation: Config.instance.query_values_notation) || {}).merge(@query_params)
189
+ @pattern.query = WebMock::Util::QueryMapper.values_to_query(query_hash, notation: WebMock::Config.instance.query_values_notation)
190
190
  @query_params = nil
191
191
  end
192
192
  end
@@ -254,7 +254,7 @@ module WebMock
254
254
  when :xml then
255
255
  Crack::XML.parse(body)
256
256
  else
257
- WebMock::Util::QueryMapper.query_to_values(body, :notation => Config.instance.query_values_notation)
257
+ WebMock::Util::QueryMapper.query_to_values(body, notation: Config.instance.query_values_notation)
258
258
  end
259
259
  end
260
260
 
@@ -307,7 +307,7 @@ module WebMock
307
307
  end
308
308
 
309
309
  def normalize_hash(hash)
310
- Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(hash, :deep => true).sort]
310
+ Hash[WebMock::Util::HashKeysStringifier.stringify_keys!(hash, deep: true).sort]
311
311
  end
312
312
 
313
313
  end
@@ -30,14 +30,14 @@ module WebMock
30
30
 
31
31
  def to_raise(*exceptions)
32
32
  @responses_sequences << ResponsesSequence.new([*exceptions].flatten.map {|e|
33
- ResponseFactory.response_for(:exception => e)
33
+ ResponseFactory.response_for(exception: e)
34
34
  })
35
35
  self
36
36
  end
37
37
  alias_method :and_raise, :to_raise
38
38
 
39
39
  def to_timeout
40
- @responses_sequences << ResponsesSequence.new([ResponseFactory.response_for(:should_timeout => true)])
40
+ @responses_sequences << ResponsesSequence.new([ResponseFactory.response_for(should_timeout: true)])
41
41
  self
42
42
  end
43
43
  alias_method :and_timeout, :to_timeout
@@ -84,15 +84,15 @@ module WebMock
84
84
 
85
85
  if signature.body.to_s != ''
86
86
  body = if signature.url_encoded?
87
- WebMock::Util::QueryMapper.query_to_values(signature.body, :notation => Config.instance.query_values_notation)
87
+ WebMock::Util::QueryMapper.query_to_values(signature.body, notation: Config.instance.query_values_notation)
88
88
  else
89
89
  signature.body
90
90
  end
91
- stub.with(:body => body)
91
+ stub.with(body: body)
92
92
  end
93
93
 
94
94
  if (signature.headers && !signature.headers.empty?)
95
- stub.with(:headers => signature.headers)
95
+ stub.with(headers: signature.headers)
96
96
  end
97
97
  stub
98
98
  end