Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 355 lines (202 sloc) 13.815 kb
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
1 #Changelog
2
473b709 @bblimke Added WebMock.reset! method. WebMock.reset_webmock is now deprecated
authored
3 ## Master
4
acaab83 @bblimke Updated changelog with the latest changes in master.
authored
5 * `WebMock.reset_webmock` is deprecated in favour of new `WebMock.reset!`
6
7 * Fixed integration with Cucumber. Previously documented example didn't work with new versions of Cucumber.
8
9 * Simplified integration with Test::Unit, RSpec and Cucumber, by requiring a single file i.e.
10
11 require 'webmock/test_unit'
12 require 'webmock/rspec'
13 require 'webmock/cucumber'
14
a7cb4fa @bblimke Fixed issue with stubbing requests with request body declared as a hash,...
authored
15 * Fixed issue with stubbing requests with request body declared as a hash, when json was not required. Thanks to Erik Michaels-Ober for reporting the issue.
16
178bfd1 @bblimke em-http-request adapter now works correctly when :query option value is ...
authored
17 * Fixed issue with em-http-request adapter which didn't work when :query option value was as a string, not a hash. Thanks to Chee Yeo for reporting the issue.
18
f45ac01 @bblimke Fixed problem with assert_requested, which doesn't work if used outside ...
authored
19 * Fixed problem with assert_requested, which doesn't work if used outside rspec or test/unit
473b709 @bblimke Added WebMock.reset! method. WebMock.reset_webmock is now deprecated
authored
20
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
21 ## 1.5.0
f0408f8 @bblimke Added support for dynamically evaluated raw responses recorded with `cur...
authored
22
23 * Support for dynamically evaluated raw responses recorded with `curl -is` <br/>
24 i.e.
25
26 `curl -is www.example.com > /tmp/www.example.com.txt`
27 stub_request(:get, "www.example.com").to_return(lambda { |request| File.new("/tmp/#{request.uri.host.to_s}.txt" }))
28
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
29 * `:net_http_connect_on_start` option can be passed to `WebMock.allow_net_connect!` and `WebMock.disable_net_connect!` methods, i.e.
ffbcdb3 @bblimke Updated changelog with the latest changes in master branch
authored
30
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
31 WebMock.allow_net_connect!(:net_http_connect_on_start => true)
ffbcdb3 @bblimke Updated changelog with the latest changes in master branch
authored
32
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
33 This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`. Check 'Connecting on Net::HTTP.start' in README for more information.
ffbcdb3 @bblimke Updated changelog with the latest changes in master branch
authored
34
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
35 Thanks to Alastair Brunton for reporting the issue and for fix suggestions.
4e313c2 @bblimke Updated CHANGELOG and README with information about net_http_connect_on_...
authored
36
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
37 * Fixed an issue where Patron spec tried to remove system temporary directory.
38 Thanks to Hans de Graaff
4e313c2 @bblimke Updated CHANGELOG and README with information about net_http_connect_on_...
authored
39
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
40 * WebMock specs now use RSpec 2
4e313c2 @bblimke Updated CHANGELOG and README with information about net_http_connect_on_...
authored
41
079a719 @bblimke Updated changelog with version 1.5.0 changes
authored
42 * `rake spec NO_CONNECTION=true` can now be used to only run WebMock specs which do not make real network connections
4e313c2 @bblimke Updated CHANGELOG and README with information about net_http_connect_on_...
authored
43
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
44 ## 1.4.0
6eb8bb5 @bblimke WebMock tries to use already loaded version of RSpec (1.x or 2.x) (previ...
authored
45
aaf774b @bblimke Added info to changelog and readme about Curb support, implemented by Pe...
authored
46 * Curb support!!! Thanks to the awesome work of Pete Higgins!
47
2328c00 @bblimke Updated Changelog with the latest changes in master
authored
48 * `include WebMock` is now deprecated to avoid method and constant name conflicts. Please `include WebMock::API` instead.
49
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
50 * `WebMock::API#request` is renamed to `WebMock::API#a_request` to prevent method name conflicts with i.e. Rails controller specs.
2328c00 @bblimke Updated Changelog with the latest changes in master
authored
51 WebMock.request is still available.
52
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
53 * Deprecated `WebMock#request`, `WebMock#allow_net_connect!`, `WebMock#net_connect_allowed?`, `WebMock#registered_request?`, `WebMock#reset_callbacks`, `WebMock#after_request` instance methods. These methods are still available, but only as WebMock class methods.
9fded75 @bblimke Updated CHANGELOG with more detailed information on changes in master
authored
54
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
55 * Removed `WebMock.response_for_request` and `WebMock.assertion_failure` which were only used internally and were not documented.
9fded75 @bblimke Updated CHANGELOG with more detailed information on changes in master
authored
56
c646491 @bblimke :allow_localhost => true' now permits 0.0.0.0 in addition to 127.0.0.1 a...
authored
57 * :allow_localhost => true' now permits 0.0.0.0 in addition to 127.0.0.1 and 'localhost'. Thanks to Myron Marston and Mike Gehard for suggesting this.
58
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
59 * Fixed issue with both RSpec 1.x and 2.x being available.
6eb8bb5 @bblimke WebMock tries to use already loaded version of RSpec (1.x or 2.x) (previ...
authored
60
a53f1a0 @bblimke Updated CHANGELOG with version 1.4.0 changes
authored
61 WebMock now tries to use already loaded version of RSpec (1.x or 2.x). Previously it was loading RSpec 2.0 if available, even if RSpec 1.3 was already loaded.
6eb8bb5 @bblimke WebMock tries to use already loaded version of RSpec (1.x or 2.x) (previ...
authored
62
63 Thanks to Hans de Graaff for reporting this.
64
9acf181 @bblimke Updated changelog for version 1.4.0
authored
65 * Changed runtime dependency on Addressable version 2.2.2 which fixes handling of percent-escaped '+'
66
67a0819 @bblimke Version 1.3.5 changelog + updated docs
authored
67 ## 1.3.5
68
69 * External requests can be disabled while allowing selected hosts. Thanks to Charles Li and Ryan Bigg
70
71 This feature was available before only for localhost with `:allow_localhost => true`
72
73 WebMock.disable_net_connect!(:allow => "www.example.org")
74
75 Net::HTTP.get('www.something.com', '/') # ===> Failure
76
77 Net::HTTP.get('www.example.org', '/') # ===> Allowed.
78
79 * Fixed Net::HTTP adapter so that it preserves the original behavior of Net::HTTP.
80
81 When making a request with a block that calls #read_body on the request,
82 Net::HTTP causes the body to be set to a Net::ReadAdapter, but WebMock was causing the body to be set to a string.
83
688e687 Version 1.3.4 changelog
Bartosz Blimke and Oliver Nightingale authored
84 ## 1.3.4
85
86 * Fixed Net::HTTP adapter to handle cases where a block with `read_body` call is passed to `request`.
87 This fixes compatibility with `open-uri`. Thanks to Mark Evans for reporting the issue.
88
db5fcf4 Version 1.3.3 changelog.
Bartosz Blimke and Ben Pickles authored
89 ## 1.3.3
90
91 * Fixed handling of multiple values for the same response header for Net::HTTP. Thanks to Myron Marston for reporting the issue.
92
27c0f65 Version 1.3.2 changelog
Bartosz Blimke and Ben Pickles authored
93 ## 1.3.2
94
95 * Fixed compatibility with EM-HTTP-Request >= 0.2.9. Thanks to Myron Marston for reporting the issue.
96
15f888e @bblimke The less hacky way to get the stream behaviour working for em-http-reque...
authored
97 ## 1.3.1
98
60fa244 @bblimke Updated changelog
authored
99 * The less hacky way to get the stream behaviour working for em-http-request. Thanks to Martyn Loughran
100
101 * Fixed issues where Net::HTTP was not accepting valid nil response body. Thanks to Muness Alrubaie
15f888e @bblimke The less hacky way to get the stream behaviour working for em-http-reque...
authored
102
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
103 ## 1.3.0
104
105 * Added support for [em-http-request](http://github.com/igrigorik/em-http-request)
106
107 * Matching query params using a hash
108
109 stub_http_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})
110
111 RestClient.get("http://www.example.com/?a[]=b&a[]=c") # ===> Success
112
113 request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made # ===> Success
114
115 * Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
26cb92f Small improvements to CHANGELOG for version 1.3.0
Bartosz Blimke authored
116
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
117 (Thanks to Steve Tooke for the idea and a solution for url-encoded bodies)
118
119 stub_http_request(:post, "www.example.com").
120 with(:body => {:data => {:a => '1', :b => 'five'}})
121
122 RestClient.post('www.example.com', "data[a]=1&data[b]=five",
123 :content_type => 'application/x-www-form-urlencoded') # ===> Success
124
125 RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
126 :content_type => 'application/json') # ===> Success
127
128 RestClient.post('www.example.com', '<data a="1" b="five" />',
129 :content_type => 'application/xml' ) # ===> Success
130
131 request(:post, "www.example.com").
132 with(:body => {:data => {:a => '1', :b => 'five'}},
133 :headers => 'Content-Type' => 'application/json').should have_been_made # ===> Success
134
135 * Request callbacks (Thanks to Myron Marston for all suggestions)
136
137 WebMock can now invoke callbacks for stubbed or real requests:
138
139 WebMock.after_request do |request_signature, response|
140 puts "Request #{request_signature} was made and #{response} was returned"
141 end
142
143 invoke callbacks for real requests only and except requests made with Patron client
144
145 WebMock.after_request(:except => [:patron], :real_requests_only => true) do |request_signature, response|
146 puts "Request #{request_signature} was made and #{response} was returned"
147 end
148
149 * `to_raise()` now accepts an exception instance or a string as argument in addition to an exception class
150
151 stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))
152
153 stub_request(:any, 'www.example.net').to_raise("some error")
154
26cb92f Small improvements to CHANGELOG for version 1.3.0
Bartosz Blimke authored
155 * Matching requests based on a URI is 30% faster
354af66 Updated CHANGELOG width version 1.3.0 changes
Bartosz Blimke authored
156
157 * Fixed constant namespace issues in HTTPClient adapter. Thanks to Nathaniel Bibler for submitting a patch.
158
fd2472a Version 1.2.2 changelog
Bartosz Blimke authored
159 ## 1.2.2
160
161 * Fixed problem where ArgumentError was raised if query params were made up of an array e.g. data[]=a&data[]=b. Thanks to Steve Tooke
162
5803f31 Version bump to 1.2.1
Bartosz Blimke authored
163 ## 1.2.1
164
165 * Changed license from GPL to MIT
166
167 * Fixed gemspec file. Thanks to Razic
168
31b3ffb Added version 1.2.0 changelog
Bartosz Blimke authored
169 ## 1.2.0
170
171 * RSpec 2 compatibility. Thanks to Sam Phillips!
172
173 * :allow_localhost => true' now permits 127.0.0.1 as well as 'localhost'. Thanks to Mack Earnhardt
174
175 * Request URI matching in now 2x faster!
176
177
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
178 ## 1.1.0
179
ee7b3b4 Fixed spelling
Bartosz Blimke authored
180 * [VCR](http://github.com/myronmarston/vcr/) compatibility. Many thanks to Myron Marston for all suggestions.
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
181
182 * Support for stubbing requests and returning responses with multiple headers with the same name. i.e multiple Accept headers.
183
184 stub_http_request(:get, 'www.example.com').
185 with(:headers => {'Accept' => ['image/png', 'image/jpeg']}).
186 to_return(:body => 'abc')
187 RestClient.get('www.example.com',
188 {"Accept" => ['image/png', 'image/jpeg']}) # ===> "abc\n"
189
190 * When real net connections are disabled and unstubbed request is made, WebMock throws WebMock::NetConnectNotAllowedError instead of assertion error or StandardError.
191
192 * Added WebMock.version()
193
194
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
195 ## 1.0.0
196
197 * Added support for [Patron](http://toland.github.com/patron/)
198
199 * Responses dynamically evaluated from block (idea and implementation by Tom Ward)
200
201 stub_request(:any, 'www.example.net').
202 to_return { |request| {:body => request.body} }
203
204 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
205
206 * Responses dynamically evaluated from lambda (idea and implementation by Tom Ward)
207
208 stub_request(:any, 'www.example.net').
209 to_return(lambda { |request| {:body => request.body} })
210
211 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
212
213 * Response with custom status message
214
215 stub_request(:any, "www.example.com").to_return(:status => [500, "Internal Server Error"])
216
217 req = Net::HTTP::Get.new("/")
218 Net::HTTP.start("www.example.com") { |http| http.request(req) }.message # ===> "Internal Server Error"
219
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
220 * Raising timeout errors (suggested by Jeffrey Jones) (compatibility with Ruby 1.8.6 by Mack Earnhardt)
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
221
222 stub_request(:any, 'www.example.net').to_timeout
223
224 RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout
225
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
226 * External requests can be disabled while allowing localhost (idea and implementation by Mack Earnhardt)
227
228 WebMock.disable_net_connect!(:allow_localhost => true)
229
230 Net::HTTP.get('www.something.com', '/') # ===> Failure
231
232 Net::HTTP.get('localhost:9887', '/') # ===> Allowed. Perhaps to Selenium?
233
234
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
235 ### Bug fixes
236
237 * Fixed issue where Net::HTTP adapter didn't work for requests with body responding to read (reported by Tekin Suleyman)
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
238 * Fixed issue where request stub with headers declared as nil was matching requests with non empty headers
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
239
b6c3b3b Version bump to 0.9.1
Bartosz Blimke authored
240 ## 0.9.1
241
242 * Fixed issue where response status code was not read from raw (curl -is) responses
243
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
244 ## 0.9.0
245
246 * Matching requests against provided block (by Sergio Gil)
247
248 stub_request(:post, "www.example.com").with { |request| request.body == "abc" }.to_return(:body => "def")
249 RestClient.post('www.example.com', 'abc') # ===> "def\n"
250 request(:post, "www.example.com").with { |req| req.body == "abc" }.should have_been_made
251 #or
252 assert_requested(:post, "www.example.com") { |req| req.body == "abc" }
253
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
254 * Matching request body against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
255
256 stub_request(:post, "www.example.com").with(:body => /^.*world$/).to_return(:body => "abc")
257 RestClient.post('www.example.com', 'hello world') # ===> "abc\n"
258
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
259 * Matching request headers against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
260
261 stub_request(:post, "www.example.com").with(:headers => {"Content-Type" => /image\/.+/}).to_return(:body => "abc")
262 RestClient.post('www.example.com', '', {'Content-Type' => 'image/png'}) # ===> "abc\n"
263
264 * Replaying raw responses recorded with `curl -is`
265
266 `curl -is www.example.com > /tmp/example_curl_-is_output.txt`
267 raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
268
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
269 from file
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
270
271 stub_request(:get, "www.example.com").to_return(raw_response_file)
272
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
273 or string
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
274
275 stub_request(:get, "www.example.com").to_return(raw_response_file.read)
276
277 * Multiple responses for repeated requests
278
279 stub_request(:get, "www.example.com").to_return({:body => "abc"}, {:body => "def"})
280 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
281 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
282
283 * Multiple responses using chained `to_return()` or `to_raise()` declarations
284
285 stub_request(:get, "www.example.com").
286 to_return({:body => "abc"}).then. #then() just is a syntactic sugar
287 to_return({:body => "def"}).then.
288 to_raise(MyException)
289 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
290 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
291 Net::HTTP.get('www.example.com', '/') # ===> MyException raised
292
293 * Specifying number of times given response should be returned
294
295 stub_request(:get, "www.example.com").
296 to_return({:body => "abc"}).times(2).then.
297 to_return({:body => "def"})
298
299 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
300 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
301 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
302
303 * Added support for `Net::HTTP::Post#body_stream`
304
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
305 This fixes compatibility with new versions of RestClient
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
306
307 * WebMock doesn't suppress default request headers added by http clients anymore.
308
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
309 i.e. Net::HTTP adds `'Accept'=>'*/*'` to all requests by default
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
310
311
312
313 ## 0.8.2
314
315 * Fixed issue where WebMock was not closing IO object passed as response body after reading it.
316 * Ruby 1.9.2 compat: Use `File#expand_path` for require path because "." is not be included in LOAD_PATH since Ruby 1.9.2
317
318
319 ## 0.8.1
320
321 * Fixed HTTPClient adapter compatibility with Ruby 1.8.6 (reported by Piotr Usewicz)
322 * Net:HTTP adapter now handles request body assigned as Net::HTTP::Post#body attribute (fixed by Mack Earnhardt)
323 * Fixed issue where requests were not matching stubs with Accept header set.(reported by Piotr Usewicz)
324 * Fixed compatibility with Ruby 1.9.1, 1.9.2 and JRuby 1.3.1 (reported by Diego E. “Flameeyes” Pettenò)
325 * Fixed issue with response body declared as IO object and multiple requests (reported by Niels Meersschaert)
326 * Fixed "undefined method `assertion_failure'" error (reported by Nick Plante)
327
328
329 ## 0.8.0
330
331 * Support for HTTPClient (sync and async requests)
332 * Support for dynamic responses. Response body and headers can be now declared as lambda.
333 (Thanks to Ivan Vega ( @ivanyv ) for suggesting this feature)
334 * Support for stubbing and expecting requests with empty body
335 * Executing non-stubbed request leads to failed expectation instead of error
336
337
338 ### Bug fixes
339
340 * Basic authentication now works correctly
341 * Fixed problem where WebMock didn't call a block with the response when block was provided
342 * Fixed problem where uris with single slash were not matching uris without path provided
343
344
345 ## 0.7.3
346
347 * Clarified documentation
348 * Fixed some issues with loading of Webmock classes
349 * Test::Unit and RSpec adapters have to be required separately
350
351
352 ## 0.7.2
353
354 * Added support for matching escaped and non escaped URLs
Something went wrong with that request. Please try again.