Skip to content
Newer
Older
100644 118 lines (72 sloc) 4.28 KB
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored Jan 31, 2010
1 #Changelog
2
b6c3b3b Version bump to 0.9.1
Bartosz Blimke authored Feb 2, 2010
3 ## 0.9.1
4
5 * Fixed issue where response status code was not read from raw (curl -is) responses
6
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored Jan 31, 2010
7 ## 0.9.0
8
9 * Matching requests against provided block (by Sergio Gil)
10
11 stub_request(:post, "www.example.com").with { |request| request.body == "abc" }.to_return(:body => "def")
12 RestClient.post('www.example.com', 'abc') # ===> "def\n"
13 request(:post, "www.example.com").with { |req| req.body == "abc" }.should have_been_made
14 #or
15 assert_requested(:post, "www.example.com") { |req| req.body == "abc" }
16
17 * Matching request body against regular expressions
18
19 stub_request(:post, "www.example.com").with(:body => /^.*world$/).to_return(:body => "abc")
20 RestClient.post('www.example.com', 'hello world') # ===> "abc\n"
21
22 * Matching request headers against regular expressions
23
24 stub_request(:post, "www.example.com").with(:headers => {"Content-Type" => /image\/.+/}).to_return(:body => "abc")
25 RestClient.post('www.example.com', '', {'Content-Type' => 'image/png'}) # ===> "abc\n"
26
27 * Replaying raw responses recorded with `curl -is`
28
29 `curl -is www.example.com > /tmp/example_curl_-is_output.txt`
30 raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
31
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored Jan 31, 2010
32 from file
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored Jan 31, 2010
33
34 stub_request(:get, "www.example.com").to_return(raw_response_file)
35
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored Jan 31, 2010
36 or string
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored Jan 31, 2010
37
38 stub_request(:get, "www.example.com").to_return(raw_response_file.read)
39
40 * Multiple responses for repeated requests
41
42 stub_request(:get, "www.example.com").to_return({:body => "abc"}, {:body => "def"})
43 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
44 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
45
46 * Multiple responses using chained `to_return()` or `to_raise()` declarations
47
48 stub_request(:get, "www.example.com").
49 to_return({:body => "abc"}).then. #then() just is a syntactic sugar
50 to_return({:body => "def"}).then.
51 to_raise(MyException)
52 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
53 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
54 Net::HTTP.get('www.example.com', '/') # ===> MyException raised
55
56 * Specifying number of times given response should be returned
57
58 stub_request(:get, "www.example.com").
59 to_return({:body => "abc"}).times(2).then.
60 to_return({:body => "def"})
61
62 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
63 Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
64 Net::HTTP.get('www.example.com', '/') # ===> "def\n"
65
66 * Added support for `Net::HTTP::Post#body_stream`
67
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored Jan 31, 2010
68 This fixes compatibility with new versions of RestClient
5313e02 Added version 0.9.0 features to CHANGELOG and README
Bartosz Blimke authored Jan 31, 2010
69
70 * WebMock doesn't suppress default request headers added by http clients anymore.
71
c2648fc Fixed formatting in 0.9.0 changelog
Bartosz Blimke authored Jan 31, 2010
72 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 Jan 31, 2010
73
74
75
76 ## 0.8.2
77
78 * Fixed issue where WebMock was not closing IO object passed as response body after reading it.
79 * 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
80
81
82 ## 0.8.1
83
84 * Fixed HTTPClient adapter compatibility with Ruby 1.8.6 (reported by Piotr Usewicz)
85 * Net:HTTP adapter now handles request body assigned as Net::HTTP::Post#body attribute (fixed by Mack Earnhardt)
86 * Fixed issue where requests were not matching stubs with Accept header set.(reported by Piotr Usewicz)
87 * Fixed compatibility with Ruby 1.9.1, 1.9.2 and JRuby 1.3.1 (reported by Diego E. “Flameeyes” Pettenò)
88 * Fixed issue with response body declared as IO object and multiple requests (reported by Niels Meersschaert)
89 * Fixed "undefined method `assertion_failure'" error (reported by Nick Plante)
90
91
92 ## 0.8.0
93
94 * Support for HTTPClient (sync and async requests)
95 * Support for dynamic responses. Response body and headers can be now declared as lambda.
96 (Thanks to Ivan Vega ( @ivanyv ) for suggesting this feature)
97 * Support for stubbing and expecting requests with empty body
98 * Executing non-stubbed request leads to failed expectation instead of error
99
100
101 ### Bug fixes
102
103 * Basic authentication now works correctly
104 * Fixed problem where WebMock didn't call a block with the response when block was provided
105 * Fixed problem where uris with single slash were not matching uris without path provided
106
107
108 ## 0.7.3
109
110 * Clarified documentation
111 * Fixed some issues with loading of Webmock classes
112 * Test::Unit and RSpec adapters have to be required separately
113
114
115 ## 0.7.2
116
117 * Added support for matching escaped and non escaped URLs
Something went wrong with that request. Please try again.