Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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