Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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