webmock 1.23.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,7 @@ rescue LoadError
|
|
5
5
|
end
|
6
6
|
|
7
7
|
if defined?(Curl)
|
8
|
-
WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', '0.8.7').check_version!
|
8
|
+
WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', '0.9.1', ['0.8.7']).check_version!
|
9
9
|
|
10
10
|
module WebMock
|
11
11
|
module HttpLibAdapters
|
@@ -24,9 +24,10 @@
|
|
24
24
|
|
25
25
|
module WebMock
|
26
26
|
class VersionChecker
|
27
|
-
def initialize(library_name, library_version, min_patch_level, max_minor_version = nil)
|
27
|
+
def initialize(library_name, library_version, min_patch_level, max_minor_version = nil, unsupported_versions = [])
|
28
28
|
@library_name, @library_version = library_name, library_version
|
29
29
|
@min_patch_level, @max_minor_version = min_patch_level, max_minor_version
|
30
|
+
@unsupported_versions = unsupported_versions || []
|
30
31
|
|
31
32
|
@major, @minor, @patch = parse_version(library_version)
|
32
33
|
@min_major, @min_minor, @min_patch = parse_version(min_patch_level)
|
@@ -38,6 +39,7 @@ module WebMock
|
|
38
39
|
def check_version!
|
39
40
|
warn_about_too_low if too_low?
|
40
41
|
warn_about_too_high if too_high?
|
42
|
+
warn_about_unsupported_version if unsupported_version?
|
41
43
|
end
|
42
44
|
|
43
45
|
private
|
@@ -50,6 +52,10 @@ module WebMock
|
|
50
52
|
@comparison_result == :too_high
|
51
53
|
end
|
52
54
|
|
55
|
+
def unsupported_version?
|
56
|
+
@unsupported_versions.include?(@library_version)
|
57
|
+
end
|
58
|
+
|
53
59
|
def warn_about_too_low
|
54
60
|
warn_in_red "You are using #{@library_name} #{@library_version}. " +
|
55
61
|
"WebMock supports version #{version_requirement}."
|
@@ -61,6 +67,12 @@ module WebMock
|
|
61
67
|
"It may not work with this version."
|
62
68
|
end
|
63
69
|
|
70
|
+
def warn_about_unsupported_version
|
71
|
+
warn_in_red "You are using #{@library_name} #{@library_version}. " +
|
72
|
+
"WebMock does not support this version. " +
|
73
|
+
"WebMock supports versions #{version_requirement}."
|
74
|
+
end
|
75
|
+
|
64
76
|
def warn_in_red(text)
|
65
77
|
Kernel.warn colorize(text, "\e[31m")
|
66
78
|
end
|
@@ -80,6 +92,7 @@ module WebMock
|
|
80
92
|
def version_requirement
|
81
93
|
req = ">= #{@min_patch_level}"
|
82
94
|
req += ", < #{@max_major}.#{@max_minor + 1}" if @max_minor
|
95
|
+
req += ", except versions #{@unsupported_versions.join(',')}" unless @unsupported_versions.empty?
|
83
96
|
req
|
84
97
|
end
|
85
98
|
|
data/lib/webmock/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -48,7 +48,6 @@ RSpec.configure do |config|
|
|
48
48
|
config.filter_run :focus => true
|
49
49
|
config.run_all_when_everything_filtered = true
|
50
50
|
end
|
51
|
-
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
52
51
|
|
53
52
|
def fail()
|
54
53
|
raise_error(RSpec::Expectations::ExpectationNotMetError)
|
@@ -55,5 +55,11 @@ module WebMock
|
|
55
55
|
expect(Kernel).not_to receive(:warn)
|
56
56
|
checker.check_version!
|
57
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.})
|
62
|
+
checker.check_version!
|
63
|
+
end
|
58
64
|
end
|
59
65
|
end
|
data/webmock.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency 'em-http-request', '>= 1.0.2'
|
29
29
|
s.add_development_dependency 'http', ((RUBY_VERSION <= '1.9.3') ? '0.7.3' : '>= 0.8.0')
|
30
30
|
s.add_development_dependency 'em-synchrony', '>= 1.0.0' if RUBY_VERSION >= "1.9"
|
31
|
-
s.add_development_dependency 'curb', '
|
31
|
+
s.add_development_dependency 'curb', '>= 0.7.16' unless RUBY_PLATFORM =~ /java/
|
32
32
|
s.add_development_dependency 'typhoeus', '>= 0.5.0' unless RUBY_PLATFORM =~ /java/
|
33
33
|
s.add_development_dependency('manticore', manticore_version) if RUBY_PLATFORM =~ /java/
|
34
34
|
s.add_development_dependency 'excon', '>= 0.27.5'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 119
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 24
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.24.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bartosz Blimke
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2016-02-
|
18
|
+
date: 2016-02-19 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -149,14 +149,14 @@ dependencies:
|
|
149
149
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|
152
|
-
- -
|
152
|
+
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
hash:
|
154
|
+
hash: 35
|
155
155
|
segments:
|
156
156
|
- 0
|
157
|
-
-
|
158
|
-
-
|
159
|
-
version: 0.
|
157
|
+
- 7
|
158
|
+
- 16
|
159
|
+
version: 0.7.16
|
160
160
|
prerelease: false
|
161
161
|
requirement: *id009
|
162
162
|
name: curb
|