Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 180 lines (106 sloc) 6.768 kb
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
1 #Changelog
2
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
3 ## 1.1.0
4
ee7b3b4 Fixed spelling
Bartosz Blimke authored
5 * [VCR](http://github.com/myronmarston/vcr/) compatibility. Many thanks to Myron Marston for all suggestions.
4a04017 Added 1.1.0 changelog
Bartosz Blimke authored
6
7 * Support for stubbing requests and returning responses with multiple headers with the same name. i.e multiple Accept headers.
8
9 stub_http_request(:get, 'www.example.com').
10 with(:headers => {'Accept' => ['image/png', 'image/jpeg']}).
11 to_return(:body => 'abc')
12 RestClient.get('www.example.com',
13 {"Accept" => ['image/png', 'image/jpeg']}) # ===> "abc\n"
14
15 * When real net connections are disabled and unstubbed request is made, WebMock throws WebMock::NetConnectNotAllowedError instead of assertion error or StandardError.
16
17 * Added WebMock.version()
18
19
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
20 ## 1.0.0
21
22 * Added support for [Patron](http://toland.github.com/patron/)
23
24 * Responses dynamically evaluated from block (idea and implementation by Tom Ward)
25
26 stub_request(:any, 'www.example.net').
27 to_return { |request| {:body => request.body} }
28
29 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
30
31 * Responses dynamically evaluated from lambda (idea and implementation by Tom Ward)
32
33 stub_request(:any, 'www.example.net').
34 to_return(lambda { |request| {:body => request.body} })
35
36 RestClient.post('www.example.net', 'abc') # ===> "abc\n"
37
38 * Response with custom status message
39
40 stub_request(:any, "www.example.com").to_return(:status => [500, "Internal Server Error"])
41
42 req = Net::HTTP::Get.new("/")
43 Net::HTTP.start("www.example.com") { |http| http.request(req) }.message # ===> "Internal Server Error"
44
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
45 * 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
46
47 stub_request(:any, 'www.example.net').to_timeout
48
49 RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout
50
c3c92ba Added information about allowing localhost to version 1.0.0 changelog
Bartosz Blimke authored
51 * External requests can be disabled while allowing localhost (idea and implementation by Mack Earnhardt)
52
53 WebMock.disable_net_connect!(:allow_localhost => true)
54
55 Net::HTTP.get('www.something.com', '/') # ===> Failure
56
57 Net::HTTP.get('localhost:9887', '/') # ===> Allowed. Perhaps to Selenium?
58
59
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
60 ### Bug fixes
61
62 * 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
63 * 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
64
b6c3b3b Version bump to 0.9.1
Bartosz Blimke authored
65 ## 0.9.1
66
67 * Fixed issue where response status code was not read from raw (curl -is) responses
68
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
69 ## 0.9.0
70
71 * Matching requests against provided block (by Sergio Gil)
72
73 stub_request(:post, "www.example.com").with { |request| request.body == "abc" }.to_return(:body => "def")
74 RestClient.post('www.example.com', 'abc') # ===> "def\n"
75 request(:post, "www.example.com").with { |req| req.body == "abc" }.should have_been_made
76 #or
77 assert_requested(:post, "www.example.com") { |req| req.body == "abc" }
78
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
79 * Matching request body against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
80
81 stub_request(:post, "www.example.com").with(:body => /^.*world$/).to_return(:body => "abc")
82 RestClient.post('www.example.com', 'hello world') # ===> "abc\n"
83
66519c1 Updated changelog with 1.0.0 changes
Bartosz Blimke authored
84 * Matching request headers against regular expressions (suggested by Ben Pickles)
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
85
86 stub_request(:post, "www.example.com").with(:headers => {"Content-Type" => /image\/.+/}).to_return(:body => "abc")
87 RestClient.post('www.example.com', '', {'Content-Type' => 'image/png'}) # ===> "abc\n"
88
89 * Replaying raw responses recorded with `curl -is`
90
91 `curl -is www.example.com > /tmp/example_curl_-is_output.txt`
92 raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
93
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
94 from file
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
95
96 stub_request(:get, "www.example.com").to_return(raw_response_file)
97
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
98 or string
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
99
100 stub_request(:get, "www.example.com").to_return(raw_response_file.read)
101
102 * Multiple responses for repeated requests
103
104 stub_request(:get, "www.example.com").to_return({:body => "abc"}, {:body => "def"})
105 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
106 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
107
108 * Multiple responses using chained `to_return()` or `to_raise()` declarations
109
110 stub_request(:get, "www.example.com").
111 to_return({:body => "abc"}).then. #then() just is a syntactic sugar
112 to_return({:body => "def"}).then.
113 to_raise(MyException)
114 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
115 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
116 Net::HTTP.get('www.example.com', '/') # ===> MyException raised
117
118 * Specifying number of times given response should be returned
119
120 stub_request(:get, "www.example.com").
121 to_return({:body => "abc"}).times(2).then.
122 to_return({:body => "def"})
123
124 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
125 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
126 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
127
128 * Added support for `Net::HTTP::Post#body_stream`
129
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
130 This fixes compatibility with new versions of RestClient
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored
131
132 * WebMock doesn't suppress default request headers added by http clients anymore.
133
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored
134 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
135
136
137
138 ## 0.8.2
139
140 * Fixed issue where WebMock was not closing IO object passed as response body after reading it.
141 * 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
142
143
144 ## 0.8.1
145
146 * Fixed HTTPClient adapter compatibility with Ruby 1.8.6 (reported by Piotr Usewicz)
147 * Net:HTTP adapter now handles request body assigned as Net::HTTP::Post#body attribute (fixed by Mack Earnhardt)
148 * Fixed issue where requests were not matching stubs with Accept header set.(reported by Piotr Usewicz)
149 * Fixed compatibility with Ruby 1.9.1, 1.9.2 and JRuby 1.3.1 (reported by Diego E. “Flameeyes” Pettenò)
150 * Fixed issue with response body declared as IO object and multiple requests (reported by Niels Meersschaert)
151 * Fixed "undefined method `assertion_failure'" error (reported by Nick Plante)
152
153
154 ## 0.8.0
155
156 * Support for HTTPClient (sync and async requests)
157 * Support for dynamic responses. Response body and headers can be now declared as lambda.
158 (Thanks to Ivan Vega ( @ivanyv ) for suggesting this feature)
159 * Support for stubbing and expecting requests with empty body
160 * Executing non-stubbed request leads to failed expectation instead of error
161
162
163 ### Bug fixes
164
165 * Basic authentication now works correctly
166 * Fixed problem where WebMock didn't call a block with the response when block was provided
167 * Fixed problem where uris with single slash were not matching uris without path provided
168
169
170 ## 0.7.3
171
172 * Clarified documentation
173 * Fixed some issues with loading of Webmock classes
174 * Test::Unit and RSpec adapters have to be required separately
175
176
177 ## 0.7.2
178
179 * Added support for matching escaped and non escaped URLs
Something went wrong with that request. Please try again.