webmock 1.8.6 → 3.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/CI.yml +37 -0
  3. data/.gitignore +6 -0
  4. data/CHANGELOG.md +1198 -0
  5. data/Gemfile +3 -15
  6. data/README.md +761 -305
  7. data/Rakefile +13 -40
  8. data/lib/webmock/api.rb +63 -17
  9. data/lib/webmock/callback_registry.rb +1 -1
  10. data/lib/webmock/config.rb +8 -0
  11. data/lib/webmock/cucumber.rb +2 -0
  12. data/lib/webmock/errors.rb +8 -24
  13. data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
  14. data/lib/webmock/http_lib_adapters/curb_adapter.rb +148 -84
  15. data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +224 -4
  16. data/lib/webmock/http_lib_adapters/excon_adapter.rb +104 -34
  17. data/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  18. data/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
  19. data/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
  20. data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
  21. data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
  22. data/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
  23. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +152 -86
  24. data/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
  25. data/lib/webmock/http_lib_adapters/net_http.rb +155 -46
  26. data/lib/webmock/http_lib_adapters/net_http_response.rb +1 -1
  27. data/lib/webmock/http_lib_adapters/patron_adapter.rb +16 -15
  28. data/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +76 -82
  29. data/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  30. data/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  31. data/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  32. data/lib/webmock/matchers/hash_including_matcher.rb +4 -12
  33. data/lib/webmock/minitest.rb +29 -3
  34. data/lib/webmock/rack_response.rb +14 -7
  35. data/lib/webmock/request_body_diff.rb +64 -0
  36. data/lib/webmock/request_execution_verifier.rb +38 -17
  37. data/lib/webmock/request_pattern.rb +158 -38
  38. data/lib/webmock/request_registry.rb +3 -3
  39. data/lib/webmock/request_signature.rb +7 -3
  40. data/lib/webmock/request_signature_snippet.rb +61 -0
  41. data/lib/webmock/request_stub.rb +9 -6
  42. data/lib/webmock/response.rb +30 -15
  43. data/lib/webmock/rspec/matchers/request_pattern_matcher.rb +38 -2
  44. data/lib/webmock/rspec/matchers/webmock_matcher.rb +23 -2
  45. data/lib/webmock/rspec/matchers.rb +0 -1
  46. data/lib/webmock/rspec.rb +11 -2
  47. data/lib/webmock/stub_registry.rb +31 -10
  48. data/lib/webmock/stub_request_snippet.rb +14 -6
  49. data/lib/webmock/test_unit.rb +4 -4
  50. data/lib/webmock/util/hash_counter.rb +20 -6
  51. data/lib/webmock/util/hash_keys_stringifier.rb +5 -3
  52. data/lib/webmock/util/hash_validator.rb +17 -0
  53. data/lib/webmock/util/headers.rb +23 -2
  54. data/lib/webmock/util/json.rb +20 -7
  55. data/lib/webmock/util/query_mapper.rb +281 -0
  56. data/lib/webmock/util/uri.rb +29 -19
  57. data/lib/webmock/util/values_stringifier.rb +20 -0
  58. data/lib/webmock/util/version_checker.rb +40 -2
  59. data/lib/webmock/version.rb +1 -1
  60. data/lib/webmock/webmock.rb +56 -17
  61. data/lib/webmock.rb +56 -46
  62. data/minitest/test_helper.rb +8 -3
  63. data/minitest/test_webmock.rb +4 -1
  64. data/minitest/webmock_spec.rb +16 -6
  65. data/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  66. data/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
  67. data/spec/acceptance/curb/curb_spec.rb +227 -68
  68. data/spec/acceptance/curb/curb_spec_helper.rb +11 -8
  69. data/spec/acceptance/em_http_request/em_http_request_spec.rb +322 -28
  70. data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +15 -10
  71. data/spec/acceptance/excon/excon_spec.rb +66 -4
  72. data/spec/acceptance/excon/excon_spec_helper.rb +21 -7
  73. data/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
  74. data/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
  75. data/spec/acceptance/httpclient/httpclient_spec.rb +152 -11
  76. data/spec/acceptance/httpclient/httpclient_spec_helper.rb +25 -16
  77. data/spec/acceptance/manticore/manticore_spec.rb +107 -0
  78. data/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
  79. data/spec/acceptance/net_http/net_http_shared.rb +52 -24
  80. data/spec/acceptance/net_http/net_http_spec.rb +164 -50
  81. data/spec/acceptance/net_http/net_http_spec_helper.rb +19 -10
  82. data/spec/acceptance/net_http/real_net_http_spec.rb +1 -1
  83. data/spec/acceptance/patron/patron_spec.rb +29 -40
  84. data/spec/acceptance/patron/patron_spec_helper.rb +15 -11
  85. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +229 -58
  86. data/spec/acceptance/shared/callbacks.rb +32 -30
  87. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +20 -5
  88. data/spec/acceptance/shared/enabling_and_disabling_webmock.rb +14 -14
  89. data/spec/acceptance/shared/precedence_of_stubs.rb +6 -6
  90. data/spec/acceptance/shared/request_expectations.rb +560 -296
  91. data/spec/acceptance/shared/returning_declared_responses.rb +180 -138
  92. data/spec/acceptance/shared/stubbing_requests.rb +385 -154
  93. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +78 -17
  94. data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +19 -15
  95. data/spec/acceptance/webmock_shared.rb +2 -2
  96. data/spec/fixtures/test.txt +1 -0
  97. data/spec/quality_spec.rb +27 -3
  98. data/spec/spec_helper.rb +11 -20
  99. data/spec/support/failures.rb +9 -0
  100. data/spec/support/my_rack_app.rb +8 -3
  101. data/spec/support/network_connection.rb +7 -13
  102. data/spec/support/webmock_server.rb +8 -3
  103. data/spec/unit/api_spec.rb +175 -0
  104. data/spec/unit/errors_spec.rb +116 -19
  105. data/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +1 -1
  106. data/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +2 -2
  107. data/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  108. data/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
  109. data/spec/unit/rack_response_spec.rb +54 -16
  110. data/spec/unit/request_body_diff_spec.rb +90 -0
  111. data/spec/unit/request_execution_verifier_spec.rb +147 -39
  112. data/spec/unit/request_pattern_spec.rb +462 -198
  113. data/spec/unit/request_registry_spec.rb +29 -9
  114. data/spec/unit/request_signature_snippet_spec.rb +89 -0
  115. data/spec/unit/request_signature_spec.rb +91 -49
  116. data/spec/unit/request_stub_spec.rb +71 -70
  117. data/spec/unit/response_spec.rb +100 -81
  118. data/spec/unit/stub_registry_spec.rb +37 -20
  119. data/spec/unit/stub_request_snippet_spec.rb +51 -31
  120. data/spec/unit/util/hash_counter_spec.rb +6 -6
  121. data/spec/unit/util/hash_keys_stringifier_spec.rb +4 -4
  122. data/spec/unit/util/headers_spec.rb +4 -4
  123. data/spec/unit/util/json_spec.rb +29 -3
  124. data/spec/unit/util/query_mapper_spec.rb +157 -0
  125. data/spec/unit/util/uri_spec.rb +150 -36
  126. data/spec/unit/util/version_checker_spec.rb +15 -9
  127. data/spec/unit/webmock_spec.rb +57 -4
  128. data/test/http_request.rb +3 -3
  129. data/test/shared_test.rb +45 -13
  130. data/test/test_helper.rb +1 -1
  131. data/test/test_webmock.rb +6 -0
  132. data/webmock.gemspec +30 -11
  133. metadata +308 -199
  134. data/.rvmrc +0 -1
  135. data/.travis.yml +0 -11
  136. data/Guardfile +0 -24
  137. data/lib/webmock/http_lib_adapters/em_http_request/em_http_request_0_x.rb +0 -151
  138. data/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +0 -210
@@ -4,55 +4,61 @@ module WebMock
4
4
  describe VersionChecker do
5
5
  it 'prints a warning if the major version is too low' do
6
6
  checker = VersionChecker.new('foo', '0.7.3', '1.0.0', '1.1')
7
- Kernel.should_receive(:warn).with("\e[31mYou are using foo 0.7.3. WebMock supports version >= 1.0.0, < 1.2.\e[0m")
7
+ expect(Kernel).to receive(:warn).with("\e[31mYou are using foo 0.7.3. WebMock supports version >= 1.0.0, < 1.2.\e[0m")
8
8
  checker.check_version!
9
9
  end
10
10
 
11
11
  it 'prints a warning if the minor version is too low' do
12
12
  checker = VersionChecker.new('foo', '1.0.99', '1.1.3', '1.2')
13
- Kernel.should_receive(:warn).with("\e[31mYou are using foo 1.0.99. WebMock supports version >= 1.1.3, < 1.3.\e[0m")
13
+ expect(Kernel).to receive(:warn).with("\e[31mYou are using foo 1.0.99. WebMock supports version >= 1.1.3, < 1.3.\e[0m")
14
14
  checker.check_version!
15
15
  end
16
16
 
17
17
  it 'prints a warning if the patch version is too low' do
18
18
  checker = VersionChecker.new('foo', '1.0.8', '1.0.10', '1.2')
19
- Kernel.should_receive(:warn).with("\e[31mYou are using foo 1.0.8. WebMock supports version >= 1.0.10, < 1.3.\e[0m")
19
+ expect(Kernel).to receive(:warn).with("\e[31mYou are using foo 1.0.8. WebMock supports version >= 1.0.10, < 1.3.\e[0m")
20
20
  checker.check_version!
21
21
  end
22
22
 
23
23
  it 'prints a warning if the patch version is too low and max version is not specified' do
24
24
  checker = VersionChecker.new('foo', '1.0.8', '1.0.10')
25
- Kernel.should_receive(:warn).with("\e[31mYou are using foo 1.0.8. WebMock supports version >= 1.0.10.\e[0m")
25
+ expect(Kernel).to receive(:warn).with("\e[31mYou are using foo 1.0.8. WebMock supports version >= 1.0.10.\e[0m")
26
26
  checker.check_version!
27
27
  end
28
28
 
29
29
  it 'prints a warning if the major version is too high' do
30
30
  checker = VersionChecker.new('foo', '2.0.0', '1.0.0', '1.1')
31
- Kernel.should_receive(:warn).with(/may not work with this version/)
31
+ expect(Kernel).to receive(:warn).with(/may not work with this version/)
32
32
  checker.check_version!
33
33
  end
34
34
 
35
35
  it 'prints a warning if the minor version is too high' do
36
36
  checker = VersionChecker.new('foo', '1.2.0', '1.0.0', '1.1')
37
- Kernel.should_receive(:warn).with(/may not work with this version/)
37
+ expect(Kernel).to receive(:warn).with(/may not work with this version/)
38
38
  checker.check_version!
39
39
  end
40
40
 
41
41
  it 'does not raise an error or print a warning when the major version is between the min and max' do
42
42
  checker = VersionChecker.new('foo', '2.0.0', '1.0.0', '3.0')
43
- Kernel.should_not_receive(:warn)
43
+ expect(Kernel).not_to receive(:warn)
44
44
  checker.check_version!
45
45
  end
46
46
 
47
47
  it 'does not raise an error or print a warning when the min_patch is 0.6.5, the max_minor is 0.7 and the version is 0.7.3' do
48
48
  checker = VersionChecker.new('foo', '0.7.3', '0.6.5', '0.7')
49
- Kernel.should_not_receive(:warn)
49
+ expect(Kernel).not_to receive(:warn)
50
50
  checker.check_version!
51
51
  end
52
52
 
53
53
  it 'does not raise an error or print a warning when the min_patch is 0.6.5, the max_minor is not specified and the version is 0.8.3' do
54
54
  checker = VersionChecker.new('foo', '0.8.3', '0.6.5')
55
- Kernel.should_not_receive(:warn)
55
+ expect(Kernel).not_to receive(:warn)
56
+ checker.check_version!
57
+ end
58
+
59
+ it "prints warning if version is unsupported" do
60
+ checker = VersionChecker.new('foo', '2.0.0', '1.0.0', '3.0', ['2.0.0'])
61
+ expect(Kernel).to receive(:warn).with(%r{You are using foo 2.0.0. WebMock does not support this version. WebMock supports versions >= 1.0.0, < 3.1, except versions 2.0.0.})
56
62
  checker.check_version!
57
63
  end
58
64
  end
@@ -1,7 +1,60 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "WebMock version" do
4
- it "should report version" do
5
- WebMock.version.should == WebMock::VERSION
3
+ describe "WebMock" do
4
+
5
+ describe ".version" do
6
+ it "should report version" do
7
+ expect(WebMock.version).to eq(WebMock::VERSION)
8
+ end
9
+
10
+ it "should not require safe_yaml" do
11
+ expect(defined?SafeYAML).to eq(nil)
12
+ end
13
+
14
+ it "should alias enable_net_connect! to allow_net_connect!" do
15
+ expect(WebMock.method(:enable_net_connect!)).to eq(WebMock.method(:allow_net_connect!))
16
+ end
17
+
18
+ it "should alias disallow_net_connect! to disable_net_connect!" do
19
+ expect(WebMock.method(:disallow_net_connect!)).to eq(WebMock.method(:disable_net_connect!))
20
+ end
21
+ end
22
+
23
+ describe ".net_connect_allowed?" do
24
+ context 'enabled globally' do
25
+ before do
26
+ WebMock.enable_net_connect!
27
+ end
28
+
29
+ context 'without arguments' do
30
+ it 'returns WebMock::Config.instance.allow_net_connect' do
31
+ expect(WebMock.net_connect_allowed?).to eql(true)
32
+ end
33
+ end
34
+ end
35
+
36
+ context 'disabled with allowed remote string' do
37
+ before do
38
+ WebMock.disable_net_connect!(allow: "http://192.168.64.2:20031")
39
+ end
40
+
41
+ context 'without arguments' do
42
+ it 'returns WebMock::Config.instance.allow_net_connect' do
43
+ expect(WebMock.net_connect_allowed?).to eql(false)
44
+ end
45
+ end
46
+ end
47
+
48
+ context 'disabled globally' do
49
+ before do
50
+ WebMock.disable_net_connect!
51
+ end
52
+
53
+ context 'without arguments' do
54
+ it 'returns WebMock::Config.instance.allow_net_connect' do
55
+ expect(WebMock.net_connect_allowed?).to eql(false)
56
+ end
57
+ end
58
+ end
6
59
  end
7
- end
60
+ end
data/test/http_request.rb CHANGED
@@ -17,8 +17,8 @@ module HttpRequestTestHelper
17
17
  http.request(req, options[:body])
18
18
  }
19
19
  OpenStruct.new({
20
- :body => response.body,
21
- :headers => response,
22
- :status => response.code })
20
+ body: response.body,
21
+ headers: response,
22
+ status: response.code })
23
23
  end
24
24
  end
data/test/shared_test.rb CHANGED
@@ -9,8 +9,19 @@ module SharedTest
9
9
  @stub_https = stub_http_request(:any, "https://www.example.com")
10
10
  end
11
11
 
12
+ def test_assert_requested_with_stub_and_block_raises_error
13
+ assert_raises ArgumentError do
14
+ assert_requested(@stub_http) {}
15
+ end
16
+ end
17
+
18
+ def test_assert_not_requested_with_stub_and_block_raises_error
19
+ assert_raises ArgumentError do
20
+ assert_not_requested(@stub_http) {}
21
+ end
22
+ end
23
+
12
24
  def test_error_on_non_stubbed_request
13
- default_ruby_headers = (RUBY_VERSION >= "1.9.1") ? "{'Accept'=>'*/*', 'User-Agent'=>'Ruby'}" : "{'Accept'=>'*/*'}"
14
25
  assert_raise_with_message(WebMock::NetConnectNotAllowedError, %r{Real HTTP connections are disabled. Unregistered request: GET http://www.example.net/ with headers}) do
15
26
  http_request(:get, "http://www.example.net/")
16
27
  end
@@ -18,27 +29,27 @@ module SharedTest
18
29
 
19
30
  def test_verification_that_expected_request_occured
20
31
  http_request(:get, "http://www.example.com/")
21
- assert_requested(:get, "http://www.example.com", :times => 1)
32
+ assert_requested(:get, "http://www.example.com", times: 1)
22
33
  assert_requested(:get, "http://www.example.com")
23
34
  end
24
35
 
25
36
  def test_verification_that_expected_stub_occured
26
37
  http_request(:get, "http://www.example.com/")
27
- assert_requested(@stub_http, :times => 1)
38
+ assert_requested(@stub_http, times: 1)
28
39
  assert_requested(@stub_http)
29
40
  end
30
41
 
31
42
  def test_verification_that_expected_request_didnt_occur
32
43
  expected_message = "The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times"
33
- expected_message << "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
44
+ expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
34
45
  assert_fail(expected_message) do
35
46
  assert_requested(:get, "http://www.example.com")
36
47
  end
37
48
  end
38
49
 
39
- def test_verification_that_expected_request_didnt_occur
50
+ def test_verification_that_expected_stub_didnt_occur
40
51
  expected_message = "The request ANY http://www.example.com/ was expected to execute 1 time but it executed 0 times"
41
- expected_message << "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
52
+ expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
42
53
  assert_fail(expected_message) do
43
54
  assert_requested(@stub_http)
44
55
  end
@@ -46,31 +57,52 @@ module SharedTest
46
57
 
47
58
  def test_verification_that_expected_request_occured_with_body_and_headers
48
59
  http_request(:get, "http://www.example.com/",
49
- :body => "abc", :headers => {'A' => 'a'})
60
+ body: "abc", headers: {'A' => 'a'})
50
61
  assert_requested(:get, "http://www.example.com",
51
- :body => "abc", :headers => {'A' => 'a'})
62
+ body: "abc", headers: {'A' => 'a'})
52
63
  end
53
64
 
54
65
  def test_verification_that_expected_request_occured_with_query_params
55
- stub_request(:any, "http://www.example.com").with(:query => hash_including({"a" => ["b", "c"]}))
66
+ stub_request(:any, "http://www.example.com").with(query: hash_including({"a" => ["b", "c"]}))
56
67
  http_request(:get, "http://www.example.com/?a[]=b&a[]=c&x=1")
57
68
  assert_requested(:get, "http://www.example.com",
58
- :query => hash_including({"a" => ["b", "c"]}))
69
+ query: hash_including({"a" => ["b", "c"]}))
70
+ end
71
+
72
+ def test_verification_that_expected_request_not_occured_with_query_params
73
+ stub_request(:any, 'http://www.example.com').with(query: hash_including(a: ['b', 'c']))
74
+ stub_request(:any, 'http://www.example.com').with(query: hash_excluding(a: ['b', 'c']))
75
+ http_request(:get, 'http://www.example.com/?a[]=b&a[]=c&x=1')
76
+ assert_not_requested(:get, 'http://www.example.com', query: hash_excluding('a' => ['b', 'c']))
77
+ end
78
+
79
+ def test_verification_that_expected_request_occured_with_excluding_query_params
80
+ stub_request(:any, 'http://www.example.com').with(query: hash_excluding('a' => ['b', 'c']))
81
+ http_request(:get, 'http://www.example.com/?a[]=x&a[]=y&x=1')
82
+ assert_requested(:get, 'http://www.example.com', query: hash_excluding('a' => ['b', 'c']))
59
83
  end
60
84
 
61
85
  def test_verification_that_non_expected_request_didnt_occur
62
- expected_message = %r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
86
+ expected_message = %r(The request GET http://www.example.com/ was not expected to execute but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
63
87
  assert_fail(expected_message) do
64
88
  http_request(:get, "http://www.example.com/")
65
89
  assert_not_requested(:get, "http://www.example.com")
66
90
  end
67
91
  end
68
92
 
93
+ def test_refute_requested_alias
94
+ expected_message = %r(The request GET http://www.example.com/ was not expected to execute but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
95
+ assert_fail(expected_message) do
96
+ http_request(:get, "http://www.example.com/")
97
+ refute_requested(:get, "http://www.example.com")
98
+ end
99
+ end
100
+
69
101
  def test_verification_that_non_expected_stub_didnt_occur
70
- expected_message = %r(The request ANY http://www.example.com/ was expected to execute 0 times but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
102
+ expected_message = %r(The request ANY http://www.example.com/ was not expected to execute but it executed 1 time\n\nThe following requests were made:\n\nGET http://www.example.com/ with headers .+ was made 1 time\n\n============================================================)
71
103
  assert_fail(expected_message) do
72
104
  http_request(:get, "http://www.example.com/")
73
105
  assert_not_requested(@stub_http)
74
106
  end
75
107
  end
76
- end
108
+ end
data/test/test_helper.rb CHANGED
@@ -9,7 +9,7 @@ require 'test/unit'
9
9
  class Test::Unit::TestCase
10
10
  AssertionFailedError = Test::Unit::AssertionFailedError rescue MiniTest::Assertion
11
11
  def assert_raise_with_message(e, message, &block)
12
- e = assert_raise(e, &block)
12
+ e = assert_raises(e, &block)
13
13
  if message.is_a?(Regexp)
14
14
  assert_match(message, e.message)
15
15
  else
data/test/test_webmock.rb CHANGED
@@ -3,4 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/shared_test')
3
3
 
4
4
  class TestWebMock < Test::Unit::TestCase
5
5
  include SharedTest
6
+
7
+ def teardown
8
+ # Ensure global Test::Unit teardown was called
9
+ assert_empty WebMock::RequestRegistry.instance.requested_signatures.hash
10
+ assert_empty WebMock::StubRegistry.instance.request_stubs
11
+ end
6
12
  end
data/webmock.gemspec CHANGED
@@ -11,22 +11,41 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'http://github.com/bblimke/webmock'
12
12
  s.summary = %q{Library for stubbing HTTP requests in Ruby.}
13
13
  s.description = %q{WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.}
14
+ s.license = "MIT"
14
15
 
15
- s.rubyforge_project = 'webmock'
16
+ s.metadata = {
17
+ 'bug_tracker_uri' => 'https://github.com/bblimke/webmock/issues',
18
+ 'changelog_uri' => "https://github.com/bblimke/webmock/blob/v#{s.version}/CHANGELOG.md",
19
+ 'documentation_uri' => "https://www.rubydoc.info/gems/webmock/#{s.version}",
20
+ 'source_code_uri' => "https://github.com/bblimke/webmock/tree/v#{s.version}",
21
+ 'wiki_uri' => 'https://github.com/bblimke/webmock/wiki'
22
+ }
16
23
 
17
- s.add_dependency 'addressable', '>= 2.2.7'
18
- s.add_dependency 'crack', '>=0.1.7'
24
+ s.required_ruby_version = '>= 2.0'
19
25
 
20
- s.add_development_dependency 'rspec', '~> 2.8'
26
+ s.add_dependency 'addressable', '>= 2.8.0'
27
+ s.add_dependency 'crack', '>= 0.3.2'
28
+ s.add_dependency 'hashdiff', ['>= 0.4.0', '< 2.0.0']
29
+
30
+ unless RUBY_PLATFORM =~ /java/
31
+ s.add_development_dependency 'patron', '>= 0.4.18'
32
+ s.add_development_dependency 'curb', '>= 0.7.16'
33
+ s.add_development_dependency 'typhoeus', '>= 0.5.0'
34
+ end
35
+
36
+ s.add_development_dependency 'http', '>= 0.8.0'
37
+ s.add_development_dependency 'manticore', '>= 0.5.1' if RUBY_PLATFORM =~ /java/
38
+ s.add_development_dependency 'rack', ((RUBY_VERSION < '2.2.2') ? '1.6.0' : '> 1.6')
39
+ s.add_development_dependency 'rspec', '>= 3.1.0'
21
40
  s.add_development_dependency 'httpclient', '>= 2.2.4'
22
- s.add_development_dependency 'patron', '>= 0.4.18' unless RUBY_PLATFORM =~ /java/
23
41
  s.add_development_dependency 'em-http-request', '>= 1.0.2'
24
- s.add_development_dependency 'em-synchrony', '>= 1.0.0' if RUBY_VERSION >= "1.9"
25
- s.add_development_dependency 'curb', '>= 0.8.0' unless RUBY_PLATFORM =~ /java/
26
- s.add_development_dependency 'typhoeus', '>= 0.3.3' unless RUBY_PLATFORM =~ /java/
27
- s.add_development_dependency 'excon', '>= 0.11.0'
28
- s.add_development_dependency 'minitest', '>= 2.2.2'
29
- s.add_development_dependency 'rdoc', ((RUBY_VERSION == '1.8.6') ? '<= 3.5.0' : '>3.5.0')
42
+ s.add_development_dependency 'em-synchrony', '>= 1.0.0'
43
+ s.add_development_dependency 'excon', '>= 0.27.5'
44
+ s.add_development_dependency 'async-http', '>= 0.48.0'
45
+ s.add_development_dependency 'minitest', '>= 5.0.0'
46
+ s.add_development_dependency 'test-unit', '>= 3.0.0'
47
+ s.add_development_dependency 'rdoc', '> 3.5.0'
48
+ s.add_development_dependency 'webrick'
30
49
 
31
50
  s.files = `git ls-files`.split("\n")
32
51
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")