webmock 1.20.0 → 1.20.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -0
- data/README.md +1 -0
- data/lib/webmock/api.rb +9 -2
- data/lib/webmock/http_lib_adapters/curb_adapter.rb +8 -8
- data/lib/webmock/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.20.1
|
4
|
+
|
5
|
+
* `assert_requested` and `assert_not_requested` accept `at_least_times` and `at_most_times` options
|
6
|
+
|
7
|
+
Thanks to [Dan Buettner](https://github.com/Capncavedan)
|
8
|
+
|
9
|
+
* Silenced `instance variable undefined` warnings in Curb adapted.
|
10
|
+
|
11
|
+
Thanks to [Sven Riedel](https://github.com/sriedel)
|
12
|
+
|
3
13
|
## 1.20.0
|
4
14
|
|
5
15
|
* Add support for on_missing callback of Curb::Easy
|
data/README.md
CHANGED
@@ -930,6 +930,7 @@ People who submitted patches and new features or suggested improvements. Many th
|
|
930
930
|
* tjsousa
|
931
931
|
* Tasos Stathopoulos
|
932
932
|
* Dan Buettner
|
933
|
+
* Sven Riedel
|
933
934
|
|
934
935
|
For a full list of contributors you can visit the
|
935
936
|
[contributors](https://github.com/bblimke/webmock/contributors) page.
|
data/lib/webmock/api.rb
CHANGED
@@ -65,12 +65,19 @@ module WebMock
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def assert_request_requested(request, options = {})
|
68
|
-
|
68
|
+
times = options.delete(:times)
|
69
|
+
at_least_times = options.delete(:at_least_times)
|
70
|
+
at_most_times = options.delete(:at_most_times)
|
71
|
+
times = 1 if times.nil? && at_least_times.nil? && at_most_times.nil?
|
72
|
+
verifier = WebMock::RequestExecutionVerifier.new(request, times, at_least_times, at_most_times)
|
69
73
|
WebMock::AssertionFailure.failure(verifier.failure_message) unless verifier.matches?
|
70
74
|
end
|
71
75
|
|
72
76
|
def assert_request_not_requested(request, options = {})
|
73
|
-
|
77
|
+
times = options.delete(:times)
|
78
|
+
at_least_times = options.delete(:at_least_times)
|
79
|
+
at_most_times = options.delete(:at_most_times)
|
80
|
+
verifier = WebMock::RequestExecutionVerifier.new(request, times, at_least_times, at_most_times)
|
74
81
|
WebMock::AssertionFailure.failure(verifier.failure_message_when_negated) unless verifier.does_not_match?
|
75
82
|
end
|
76
83
|
|
@@ -143,9 +143,9 @@ if defined?(Curl)
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def invoke_curb_callbacks
|
146
|
-
@on_progress.call(0.0,1.0,0.0,1.0) if @on_progress
|
147
|
-
self.header_str.lines.each { |header_line| @on_header.call header_line } if @on_header
|
148
|
-
if @on_body
|
146
|
+
@on_progress.call(0.0,1.0,0.0,1.0) if defined?( @on_progress )
|
147
|
+
self.header_str.lines.each { |header_line| @on_header.call header_line } if defined?( @on_header )
|
148
|
+
if defined?( @on_body )
|
149
149
|
if chunked_response?
|
150
150
|
self.body_str.each do |chunk|
|
151
151
|
@on_body.call(chunk)
|
@@ -154,20 +154,20 @@ if defined?(Curl)
|
|
154
154
|
@on_body.call(self.body_str)
|
155
155
|
end
|
156
156
|
end
|
157
|
-
@on_complete.call(self) if @on_complete
|
157
|
+
@on_complete.call(self) if defined?( @on_complete )
|
158
158
|
|
159
159
|
case response_code
|
160
160
|
when 200..299
|
161
|
-
@on_success.call(self) if @on_success
|
161
|
+
@on_success.call(self) if defined?( @on_success )
|
162
162
|
when 400..499
|
163
|
-
@on_missing.call(self, self.response_code) if @on_missing
|
163
|
+
@on_missing.call(self, self.response_code) if defined?( @on_missing )
|
164
164
|
when 500..599
|
165
|
-
@on_failure.call(self, self.response_code) if @on_failure
|
165
|
+
@on_failure.call(self, self.response_code) if defined?( @on_failure )
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
169
|
def chunked_response?
|
170
|
-
@transfer_encoding == 'chunked' && self.body_str.respond_to?(:each)
|
170
|
+
defined?( @transfer_encoding ) && @transfer_encoding == 'chunked' && self.body_str.respond_to?(:each)
|
171
171
|
end
|
172
172
|
|
173
173
|
def build_webmock_response
|
data/lib/webmock/version.rb
CHANGED
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: 69
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 20
|
9
|
-
-
|
10
|
-
version: 1.20.
|
9
|
+
- 1
|
10
|
+
version: 1.20.1
|
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: 2014-
|
18
|
+
date: 2014-11-02 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|