webmock 3.0.1 → 3.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/CI.yml +38 -0
  3. data/CHANGELOG.md +496 -2
  4. data/Gemfile +1 -1
  5. data/README.md +169 -34
  6. data/Rakefile +12 -4
  7. data/lib/webmock/api.rb +12 -0
  8. data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +221 -0
  9. data/lib/webmock/http_lib_adapters/curb_adapter.rb +19 -5
  10. data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +7 -4
  11. data/lib/webmock/http_lib_adapters/excon_adapter.rb +5 -2
  12. data/lib/webmock/http_lib_adapters/http_rb/client.rb +2 -1
  13. data/lib/webmock/http_lib_adapters/http_rb/request.rb +7 -1
  14. data/lib/webmock/http_lib_adapters/http_rb/response.rb +27 -3
  15. data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +9 -3
  16. data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +7 -3
  17. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +28 -9
  18. data/lib/webmock/http_lib_adapters/manticore_adapter.rb +33 -15
  19. data/lib/webmock/http_lib_adapters/net_http.rb +36 -89
  20. data/lib/webmock/http_lib_adapters/net_http_response.rb +1 -1
  21. data/lib/webmock/http_lib_adapters/patron_adapter.rb +4 -4
  22. data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  23. data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  24. data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  25. data/lib/webmock/matchers/hash_including_matcher.rb +4 -23
  26. data/lib/webmock/rack_response.rb +1 -1
  27. data/lib/webmock/request_body_diff.rb +1 -1
  28. data/lib/webmock/request_execution_verifier.rb +2 -3
  29. data/lib/webmock/request_pattern.rb +129 -51
  30. data/lib/webmock/request_registry.rb +1 -1
  31. data/lib/webmock/request_signature.rb +3 -3
  32. data/lib/webmock/request_signature_snippet.rb +4 -4
  33. data/lib/webmock/request_stub.rb +15 -0
  34. data/lib/webmock/response.rb +19 -13
  35. data/lib/webmock/rspec.rb +10 -3
  36. data/lib/webmock/stub_registry.rb +26 -11
  37. data/lib/webmock/stub_request_snippet.rb +10 -6
  38. data/lib/webmock/test_unit.rb +1 -3
  39. data/lib/webmock/util/hash_counter.rb +3 -3
  40. data/lib/webmock/util/headers.rb +17 -2
  41. data/lib/webmock/util/json.rb +1 -2
  42. data/lib/webmock/util/query_mapper.rb +9 -7
  43. data/lib/webmock/util/uri.rb +10 -10
  44. data/lib/webmock/util/values_stringifier.rb +20 -0
  45. data/lib/webmock/version.rb +1 -1
  46. data/lib/webmock/webmock.rb +20 -3
  47. data/lib/webmock.rb +53 -48
  48. data/minitest/webmock_spec.rb +3 -3
  49. data/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  50. data/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
  51. data/spec/acceptance/curb/curb_spec.rb +44 -0
  52. data/spec/acceptance/em_http_request/em_http_request_spec.rb +57 -1
  53. data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +2 -2
  54. data/spec/acceptance/excon/excon_spec.rb +4 -2
  55. data/spec/acceptance/excon/excon_spec_helper.rb +2 -0
  56. data/spec/acceptance/http_rb/http_rb_spec.rb +20 -0
  57. data/spec/acceptance/http_rb/http_rb_spec_helper.rb +5 -2
  58. data/spec/acceptance/httpclient/httpclient_spec.rb +8 -1
  59. data/spec/acceptance/manticore/manticore_spec.rb +51 -0
  60. data/spec/acceptance/net_http/net_http_shared.rb +47 -10
  61. data/spec/acceptance/net_http/net_http_spec.rb +102 -24
  62. data/spec/acceptance/net_http/real_net_http_spec.rb +1 -1
  63. data/spec/acceptance/patron/patron_spec.rb +26 -21
  64. data/spec/acceptance/patron/patron_spec_helper.rb +3 -3
  65. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +14 -14
  66. data/spec/acceptance/shared/callbacks.rb +3 -2
  67. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +1 -1
  68. data/spec/acceptance/shared/request_expectations.rb +14 -0
  69. data/spec/acceptance/shared/returning_declared_responses.rb +36 -15
  70. data/spec/acceptance/shared/stubbing_requests.rb +95 -0
  71. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +1 -1
  72. data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +1 -1
  73. data/spec/support/webmock_server.rb +1 -0
  74. data/spec/unit/api_spec.rb +103 -3
  75. data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  76. data/spec/unit/request_execution_verifier_spec.rb +12 -12
  77. data/spec/unit/request_pattern_spec.rb +207 -49
  78. data/spec/unit/request_signature_snippet_spec.rb +2 -2
  79. data/spec/unit/request_signature_spec.rb +21 -1
  80. data/spec/unit/request_stub_spec.rb +35 -0
  81. data/spec/unit/response_spec.rb +51 -19
  82. data/spec/unit/stub_request_snippet_spec.rb +30 -10
  83. data/spec/unit/util/query_mapper_spec.rb +13 -0
  84. data/spec/unit/util/uri_spec.rb +74 -2
  85. data/spec/unit/webmock_spec.rb +108 -5
  86. data/test/shared_test.rb +15 -2
  87. data/test/test_webmock.rb +6 -0
  88. data/webmock.gemspec +15 -7
  89. metadata +86 -37
  90. data/.travis.yml +0 -20
@@ -10,23 +10,27 @@ 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
- with << "body: #{request_pattern.body_pattern.to_s}"
19
+ with << "\n body: #{request_pattern.body_pattern.to_s}"
20
20
  end
21
21
 
22
22
  if (request_pattern.headers_pattern)
23
- with << ",\n " unless with.empty?
23
+ with << "," unless with.empty?
24
24
 
25
- with << "headers: #{request_pattern.headers_pattern.to_s}"
25
+ with << "\n headers: #{request_pattern.headers_pattern.pp_to_s}"
26
26
  end
27
27
  string << ".\n with(#{with})" unless with.empty?
28
28
  if with_response
29
- string << ".\n to_return(status: 200, body: \"\", headers: {})"
29
+ if request_pattern.headers_pattern && request_pattern.headers_pattern.matches?({ 'Accept' => "application/json" })
30
+ string << ".\n to_return(status: 200, body: \"{}\", headers: {})"
31
+ else
32
+ string << ".\n to_return(status: 200, body: \"\", headers: {})"
33
+ end
30
34
  end
31
35
  string
32
36
  end
@@ -8,12 +8,10 @@ module Test
8
8
  class TestCase
9
9
  include WebMock::API
10
10
 
11
- alias_method :teardown_without_webmock, :teardown
11
+ teardown
12
12
  def teardown_with_webmock
13
- teardown_without_webmock
14
13
  WebMock.reset!
15
14
  end
16
- alias_method :teardown, :teardown_with_webmock
17
15
 
18
16
  end
19
17
  end
@@ -2,7 +2,7 @@ require 'thread'
2
2
 
3
3
  module WebMock
4
4
  module Util
5
- class Util::HashCounter
5
+ class HashCounter
6
6
  attr_accessor :hash
7
7
  def initialize
8
8
  self.hash = {}
@@ -30,8 +30,8 @@ module WebMock
30
30
  end
31
31
 
32
32
  def each(&block)
33
- @order.to_a.sort {|a, b| a[1] <=> b[1]}.each do |a|
34
- block.call(a[0], hash[a[0]])
33
+ @order.to_a.sort_by { |a| a[1] }.each do |a|
34
+ yield(a[0], hash[a[0]])
35
35
  end
36
36
  end
37
37
  end
@@ -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
@@ -34,6 +34,21 @@ module WebMock
34
34
  str << '}'
35
35
  end
36
36
 
37
+ def self.pp_headers_string(headers)
38
+ headers = WebMock::Util::Headers.normalize_headers(headers)
39
+ seperator = "\n\t "
40
+ str = "{#{seperator} ".dup
41
+ str << headers.map do |k,v|
42
+ v = case v
43
+ when Regexp then v.inspect
44
+ when Array then "["+v.map{|w| "'#{w.to_s}'"}.join(", ")+"]"
45
+ else "'#{v.to_s}'"
46
+ end
47
+ "'#{k}'=>#{v}"
48
+ end.sort.join(",#{seperator} ")
49
+ str << "\n }"
50
+ end
51
+
37
52
  def self.decode_userinfo_from_header(header)
38
53
  header.sub(/^Basic /, "").unpack("m").first
39
54
  end
@@ -24,13 +24,12 @@ module WebMock
24
24
 
25
25
  # Ensure that ":" and "," are always followed by a space
26
26
  def self.convert_json_to_yaml(json) #:nodoc:
27
- scanner, quoting, marks, pos, times = StringScanner.new(json), false, [], nil, []
27
+ scanner, quoting, marks, times = StringScanner.new(json), false, [], []
28
28
  while scanner.scan_until(/(\\['"]|['":,\\]|\\.)/)
29
29
  case char = scanner[1]
30
30
  when '"', "'"
31
31
  if !quoting
32
32
  quoting = char
33
- pos = scanner.pos
34
33
  elsif quoting == char
35
34
  quoting = false
36
35
  end
@@ -81,7 +81,7 @@ module WebMock::Util
81
81
  value = if value.nil?
82
82
  nil
83
83
  else
84
- ::Addressable::URI.unencode_component(value.gsub(/\+/, ' '))
84
+ ::Addressable::URI.unencode_component(value.tr('+', ' '))
85
85
  end
86
86
  key = Addressable::URI.unencode_component(key)
87
87
  key = key.dup.force_encoding(Encoding::ASCII_8BIT) if key.respond_to?(:force_encoding)
@@ -122,7 +122,7 @@ module WebMock::Util
122
122
 
123
123
  def fill_accumulator_for_subscript(accumulator, key, value)
124
124
  current_node = accumulator
125
- subkeys = key.split(/(?=\[\w)/)
125
+ subkeys = key.split(/(?=\[[^\[\]]+)/)
126
126
  subkeys[0..-2].each do |subkey|
127
127
  node = subkey =~ /\[\]\z/ ? [] : {}
128
128
  subkey = subkey.gsub(/[\[\]]/, '')
@@ -161,7 +161,7 @@ module WebMock::Util
161
161
  else
162
162
  if array_value
163
163
  current_node[last_key] ||= []
164
- current_node[last_key] << value
164
+ current_node[last_key] << value unless value.nil?
165
165
  else
166
166
  current_node[last_key] = value
167
167
  end
@@ -186,7 +186,9 @@ module WebMock::Util
186
186
  new_query_values = new_query_values.to_hash
187
187
  new_query_values = new_query_values.inject([]) do |object, (key, value)|
188
188
  key = key.to_s if key.is_a?(::Symbol) || key.nil?
189
- if value.is_a?(Array)
189
+ if value.is_a?(Array) && value.empty?
190
+ object << [key.to_s + '[]']
191
+ elsif value.is_a?(Array)
190
192
  value.each { |v| object << [key.to_s + '[]', v] }
191
193
  elsif value.is_a?(Hash)
192
194
  value.each { |k, v| object << ["#{key.to_s}[#{k}]", v]}
@@ -204,7 +206,7 @@ module WebMock::Util
204
206
  end
205
207
  end
206
208
 
207
- buffer = ''
209
+ buffer = ''.dup
208
210
  new_query_values.each do |parent, value|
209
211
  encoded_parent = ::Addressable::URI.encode_component(
210
212
  parent.dup, ::Addressable::URI::CharacterClasses::UNRESERVED
@@ -251,14 +253,14 @@ module WebMock::Util
251
253
  ]
252
254
  end
253
255
  value.sort!
254
- buffer = ''
256
+ buffer = ''.dup
255
257
  value.each do |key, val|
256
258
  new_parent = options[:notation] != :flat_array ? "#{parent}[#{key}]" : parent
257
259
  buffer << "#{to_query(new_parent, val, options)}&"
258
260
  end
259
261
  buffer.chop
260
262
  when ::Array
261
- buffer = ''
263
+ buffer = ''.dup
262
264
  value.each_with_index do |val, i|
263
265
  new_parent = options[:notation] != :flat_array ? "#{parent}[#{i}]" : parent
264
266
  buffer << "#{to_query(new_parent, val, options)}&"
@@ -33,7 +33,7 @@ module WebMock
33
33
  NORMALIZED_URIS[uri].dup
34
34
  end
35
35
 
36
- def self.variations_of_uri_as_strings(uri_object)
36
+ def self.variations_of_uri_as_strings(uri_object, only_with_scheme: false)
37
37
  normalized_uri = normalize_uri(uri_object.dup).freeze
38
38
  uris = [ normalized_uri ]
39
39
 
@@ -41,13 +41,13 @@ module WebMock
41
41
  uris = uris_with_trailing_slash_and_without(uris)
42
42
  end
43
43
 
44
- uris = uris_encoded_and_unencoded(uris)
45
-
46
44
  if normalized_uri.port == Addressable::URI.port_mapping[normalized_uri.scheme]
47
45
  uris = uris_with_inferred_port_and_without(uris)
48
46
  end
49
47
 
50
- if normalized_uri.scheme == "http"
48
+ uris = uris_encoded_and_unencoded(uris)
49
+
50
+ if normalized_uri.scheme == "http" && !only_with_scheme
51
51
  uris = uris_with_scheme_and_without(uris)
52
52
  end
53
53
 
@@ -80,27 +80,27 @@ module WebMock
80
80
 
81
81
  def self.uris_with_inferred_port_and_without(uris)
82
82
  uris.map { |uri|
83
- uri = uri.dup.force_encoding(Encoding::ASCII_8BIT) if uri.respond_to?(:force_encoding)
84
- [ uri, uri.gsub(%r{(:80)|(:443)}, "").freeze ]
83
+ [ uri, uri.omit(:port)]
85
84
  }.flatten
86
85
  end
87
86
 
88
87
  def self.uris_encoded_and_unencoded(uris)
89
88
  uris.map do |uri|
90
- [ uri.to_s, Addressable::URI.unencode(uri, String).freeze ]
89
+ [
90
+ uri.to_s.force_encoding(Encoding::ASCII_8BIT),
91
+ Addressable::URI.unencode(uri, String).force_encoding(Encoding::ASCII_8BIT).freeze
92
+ ]
91
93
  end.flatten
92
94
  end
93
95
 
94
96
  def self.uris_with_scheme_and_without(uris)
95
97
  uris.map { |uri|
96
- uri = uri.dup.force_encoding(Encoding::ASCII_8BIT) if uri.respond_to?(:force_encoding)
97
98
  [ uri, uri.gsub(%r{^https?://},"").freeze ]
98
99
  }.flatten
99
100
  end
100
101
 
101
102
  def self.uris_with_trailing_slash_and_without(uris)
102
- uris = uris.map { |uri|
103
- uri = uri.dup.force_encoding(Encoding::ASCII_8BIT) if uri.respond_to?(:force_encoding)
103
+ uris.map { |uri|
104
104
  [ uri, uri.omit(:path).freeze ]
105
105
  }.flatten
106
106
  end
@@ -0,0 +1,20 @@
1
+ class WebMock::Util::ValuesStringifier
2
+ def self.stringify_values(value)
3
+ case value
4
+ when String, Numeric, TrueClass, FalseClass
5
+ value.to_s
6
+ when Hash
7
+ Hash[
8
+ value.map do |k, v|
9
+ [k, stringify_values(v)]
10
+ end
11
+ ]
12
+ when Array
13
+ value.map do |v|
14
+ stringify_values(v)
15
+ end
16
+ else
17
+ value
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module WebMock
2
- VERSION = '3.0.1' unless defined?(::WebMock::VERSION)
2
+ VERSION = '3.18.1' unless defined?(::WebMock::VERSION)
3
3
  end
@@ -53,16 +53,33 @@ module WebMock
53
53
  Config.instance.net_http_connect_on_start = options[:net_http_connect_on_start]
54
54
  end
55
55
 
56
+ class << self
57
+ alias :enable_net_connect! :allow_net_connect!
58
+ alias :disallow_net_connect! :disable_net_connect!
59
+ end
60
+
56
61
  def self.net_connect_allowed?(uri = nil)
62
+ return !!Config.instance.allow_net_connect if uri.nil?
63
+
57
64
  if uri.is_a?(String)
58
65
  uri = WebMock::Util::URI.normalize_uri(uri)
59
66
  end
60
67
 
61
- Config.instance.allow_net_connect ||
68
+ !!Config.instance.allow_net_connect ||
62
69
  ( Config.instance.allow_localhost && WebMock::Util::URI.is_uri_localhost?(uri) ||
63
70
  Config.instance.allow && net_connect_explicit_allowed?(Config.instance.allow, uri) )
64
71
  end
65
72
 
73
+ def self.net_http_connect_on_start?(uri)
74
+ allowed = Config.instance.net_http_connect_on_start || false
75
+
76
+ if [true, false].include?(allowed)
77
+ allowed
78
+ else
79
+ net_connect_explicit_allowed?(allowed, uri)
80
+ end
81
+ end
82
+
66
83
  def self.net_connect_explicit_allowed?(allowed, uri=nil)
67
84
  case allowed
68
85
  when Array
@@ -133,8 +150,8 @@ module WebMock
133
150
  puts WebMock::RequestExecutionVerifier.executed_requests_message
134
151
  end
135
152
 
136
- def self.globally_stub_request(&block)
137
- WebMock::StubRegistry.instance.register_global_stub(&block)
153
+ def self.globally_stub_request(order = :before_local_stubs, &block)
154
+ WebMock::StubRegistry.instance.register_global_stub(order, &block)
138
155
  end
139
156
 
140
157
  %w(
data/lib/webmock.rb CHANGED
@@ -4,51 +4,56 @@ require 'addressable/uri'
4
4
  require 'addressable/template'
5
5
  require 'crack/xml'
6
6
 
7
- require 'webmock/deprecation'
8
- require 'webmock/version'
9
-
10
- require 'webmock/errors'
11
-
12
- require 'webmock/util/query_mapper'
13
- require 'webmock/util/uri'
14
- require 'webmock/util/headers'
15
- require 'webmock/util/hash_counter'
16
- require 'webmock/util/hash_keys_stringifier'
17
- require 'webmock/util/json'
18
- require 'webmock/util/version_checker'
19
- require 'webmock/util/hash_validator'
20
-
21
- require 'webmock/matchers/hash_including_matcher'
22
-
23
- require 'webmock/request_pattern'
24
- require 'webmock/request_signature'
25
- require 'webmock/responses_sequence'
26
- require 'webmock/request_stub'
27
- require 'webmock/response'
28
- require 'webmock/rack_response'
29
-
30
- require 'webmock/stub_request_snippet'
31
- require 'webmock/request_signature_snippet'
32
- require 'webmock/request_body_diff'
33
-
34
- require 'webmock/assertion_failure'
35
- require 'webmock/request_execution_verifier'
36
- require 'webmock/config'
37
- require 'webmock/callback_registry'
38
- require 'webmock/request_registry'
39
- require 'webmock/stub_registry'
40
- require 'webmock/api'
41
-
42
- require 'webmock/http_lib_adapters/http_lib_adapter_registry'
43
- require 'webmock/http_lib_adapters/http_lib_adapter'
44
- require 'webmock/http_lib_adapters/net_http'
45
- require 'webmock/http_lib_adapters/http_rb_adapter'
46
- require 'webmock/http_lib_adapters/httpclient_adapter'
47
- require 'webmock/http_lib_adapters/patron_adapter'
48
- require 'webmock/http_lib_adapters/curb_adapter'
49
- require 'webmock/http_lib_adapters/em_http_request_adapter'
50
- require 'webmock/http_lib_adapters/typhoeus_hydra_adapter'
51
- require 'webmock/http_lib_adapters/excon_adapter'
52
- require 'webmock/http_lib_adapters/manticore_adapter'
53
-
54
- require 'webmock/webmock'
7
+ require_relative 'webmock/deprecation'
8
+ require_relative 'webmock/version'
9
+
10
+ require_relative 'webmock/errors'
11
+
12
+ require_relative 'webmock/util/query_mapper'
13
+ require_relative 'webmock/util/uri'
14
+ require_relative 'webmock/util/headers'
15
+ require_relative 'webmock/util/hash_counter'
16
+ require_relative 'webmock/util/hash_keys_stringifier'
17
+ require_relative 'webmock/util/values_stringifier'
18
+ require_relative 'webmock/util/json'
19
+ require_relative 'webmock/util/version_checker'
20
+ require_relative 'webmock/util/hash_validator'
21
+
22
+ require_relative 'webmock/matchers/hash_argument_matcher'
23
+ require_relative 'webmock/matchers/hash_excluding_matcher'
24
+ require_relative 'webmock/matchers/hash_including_matcher'
25
+ require_relative 'webmock/matchers/any_arg_matcher'
26
+
27
+ require_relative 'webmock/request_pattern'
28
+ require_relative 'webmock/request_signature'
29
+ require_relative 'webmock/responses_sequence'
30
+ require_relative 'webmock/request_stub'
31
+ require_relative 'webmock/response'
32
+ require_relative 'webmock/rack_response'
33
+
34
+ require_relative 'webmock/stub_request_snippet'
35
+ require_relative 'webmock/request_signature_snippet'
36
+ require_relative 'webmock/request_body_diff'
37
+
38
+ require_relative 'webmock/assertion_failure'
39
+ require_relative 'webmock/request_execution_verifier'
40
+ require_relative 'webmock/config'
41
+ require_relative 'webmock/callback_registry'
42
+ require_relative 'webmock/request_registry'
43
+ require_relative 'webmock/stub_registry'
44
+ require_relative 'webmock/api'
45
+
46
+ require_relative 'webmock/http_lib_adapters/http_lib_adapter_registry'
47
+ require_relative 'webmock/http_lib_adapters/http_lib_adapter'
48
+ require_relative 'webmock/http_lib_adapters/net_http'
49
+ require_relative 'webmock/http_lib_adapters/http_rb_adapter'
50
+ require_relative 'webmock/http_lib_adapters/httpclient_adapter'
51
+ require_relative 'webmock/http_lib_adapters/patron_adapter'
52
+ require_relative 'webmock/http_lib_adapters/curb_adapter'
53
+ require_relative 'webmock/http_lib_adapters/em_http_request_adapter'
54
+ require_relative 'webmock/http_lib_adapters/typhoeus_hydra_adapter'
55
+ require_relative 'webmock/http_lib_adapters/excon_adapter'
56
+ require_relative 'webmock/http_lib_adapters/manticore_adapter'
57
+ require_relative 'webmock/http_lib_adapters/async_http_client_adapter'
58
+
59
+ require_relative 'webmock/webmock'
@@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
20
20
  end
21
21
 
22
22
  it "should raise error on non stubbed request" do
23
- lambda { http_request(:get, "http://www.example.net/") }.must_raise(WebMock::NetConnectNotAllowedError)
23
+ expect { http_request(:get, "http://www.example.net/") }.must_raise(WebMock::NetConnectNotAllowedError)
24
24
  end
25
25
 
26
26
  it "should verify that expected request occured" do
@@ -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 << "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
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 << "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
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