Skip to content

Commit

Permalink
Updated CHANGELOG width version 1.3.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Blimke committed Jun 20, 2010
1 parent 098c2cc commit 354af66
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
#Changelog

## 1.3.0

* Added support for [em-http-request](http://github.com/igrigorik/em-http-request)

* Matching query params using a hash

stub_http_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]})
RestClient.get("http://www.example.com/?a[]=b&a[]=c") # ===> Success
request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made # ===> Success

* Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
(Thanks to Steve Tooke for the idea and a solution for url-encoded bodies)

stub_http_request(:post, "www.example.com").
with(:body => {:data => {:a => '1', :b => 'five'}})

RestClient.post('www.example.com', "data[a]=1&data[b]=five",
:content_type => 'application/x-www-form-urlencoded') # ===> Success

RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
:content_type => 'application/json') # ===> Success

RestClient.post('www.example.com', '<data a="1" b="five" />',
:content_type => 'application/xml' ) # ===> Success
request(:post, "www.example.com").
with(:body => {:data => {:a => '1', :b => 'five'}},
:headers => 'Content-Type' => 'application/json').should have_been_made # ===> Success

* Request callbacks (Thanks to Myron Marston for all suggestions)

WebMock can now invoke callbacks for stubbed or real requests:

WebMock.after_request do |request_signature, response|
puts "Request #{request_signature} was made and #{response} was returned"
end

invoke callbacks for real requests only and except requests made with Patron client

WebMock.after_request(:except => [:patron], :real_requests_only => true) do |request_signature, response|
puts "Request #{request_signature} was made and #{response} was returned"
end

* `to_raise()` now accepts an exception instance or a string as argument in addition to an exception class

stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))

stub_request(:any, 'www.example.net').to_raise("some error")

* Matching request stubs based on a URI is 30% faster

* Fixed constant namespace issues in HTTPClient adapter. Thanks to Nathaniel Bibler for submitting a patch.

## 1.2.2

* 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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ You can also use WebMock without RSpec or Test::Unit support:
http.request(req, 'hello world')
} # ===> Success

### Matching requests with URL-Encoded, JSON or XML body against hash
### Matching request body against a hash. Body can be URL-Encoded, JSON or XML.

stub_http_request(:post, "www.example.com").
with(:body => {:data => {:a => '1', :b => 'five'}})
Expand Down Expand Up @@ -448,16 +448,16 @@ To record your application's real HTTP interactions and replay them later in tes

## Request callbacks

####WebMock can invoke a callback for each, stubbed or real, request:
####WebMock can invoke callbacks stubbed or real requests:

WebMock.after_request do |request_signature, response|
Log.info("Request #{request_signature} was made and #{response} was returned")
puts "Request #{request_signature} was made and #{response} was returned"
end

#### invoke callbacks for real requests only and except requests made with Patron

WebMock.after_request(:except => [:patron], :real_requests_only => true) do |request_signature, response|
Log.info("Request #{request_signature} was made and #{response} was returned")
puts "Request #{request_signature} was made and #{response} was returned"
end

## Bugs and Issues
Expand Down

0 comments on commit 354af66

Please sign in to comment.