webmock 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/README.md +3 -1
- data/VERSION +1 -1
- data/lib/webmock/http_lib_adapters/curb.rb +4 -4
- data/lib/webmock/http_lib_adapters/em_http_request.rb +1 -1
- data/spec/curb_spec.rb +18 -0
- data/spec/em_http_request_spec.rb +21 -0
- data/webmock.gemspec +2 -2
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
#Changelog
|
2
2
|
|
3
|
+
## 1.6.2
|
4
|
+
|
5
|
+
* Em-http-request adapter sets `last_effective_url` property. Thanks to [Sam Stokes](https://github.com/samstokes).
|
6
|
+
|
7
|
+
* Curb adapter supports `Curb::Easy#http_post` and `Curb::Easy#http_put` without arguments (by setting `post_body` or `put_data` beforehand). Thanks to [Eugene Bolshakov](https://github.com/eugenebolshakov)
|
8
|
+
|
3
9
|
## 1.6.1
|
4
10
|
|
5
11
|
* Fixed issue with `webmock/rspec` which didn't load correctly if `rspec/core` was already required but `rspec/expectations` not.
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Supported HTTP libraries
|
|
21
21
|
* HTTPClient
|
22
22
|
* Patron
|
23
23
|
* EM-HTTP-Request
|
24
|
-
* Curb
|
24
|
+
* Curb (currently only Curb::Easy)
|
25
25
|
|
26
26
|
##Installation
|
27
27
|
|
@@ -544,6 +544,8 @@ People who submitted patches and new features or suggested improvements. Many th
|
|
544
544
|
* Pete Higgins
|
545
545
|
* Hans de Graaff
|
546
546
|
* Alastair Brunton
|
547
|
+
* Sam Stokes
|
548
|
+
* Eugene Bolshakov
|
547
549
|
|
548
550
|
## Background
|
549
551
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.2
|
@@ -117,9 +117,9 @@ if defined?(Curl)
|
|
117
117
|
alias_method "http_#{verb}", "http_#{verb}_with_webmock"
|
118
118
|
end
|
119
119
|
|
120
|
-
def http_put_with_webmock data
|
120
|
+
def http_put_with_webmock data = nil
|
121
121
|
@webmock_method = :put
|
122
|
-
@put_data = data
|
122
|
+
@put_data = data if data
|
123
123
|
curb_or_webmock do
|
124
124
|
http_put_without_webmock(data)
|
125
125
|
end
|
@@ -127,9 +127,9 @@ if defined?(Curl)
|
|
127
127
|
alias_method :http_put_without_webmock, :http_put
|
128
128
|
alias_method :http_put, :http_put_with_webmock
|
129
129
|
|
130
|
-
def http_post_with_webmock data
|
130
|
+
def http_post_with_webmock data = nil
|
131
131
|
@webmock_method = :post
|
132
|
-
@post_body = data
|
132
|
+
@post_body = data if data
|
133
133
|
curb_or_webmock do
|
134
134
|
http_post_without_webmock(data)
|
135
135
|
end
|
data/spec/curb_spec.rb
CHANGED
@@ -153,6 +153,24 @@ unless RUBY_PLATFORM =~ /java/
|
|
153
153
|
describe "using #http_* methods for requests" do
|
154
154
|
it_should_behave_like "Curb"
|
155
155
|
include CurbSpecHelper::NamedHttp
|
156
|
+
|
157
|
+
it "should work with blank arguments for post" do
|
158
|
+
stub_http_request(:post, "www.example.com").with(:body => "01234")
|
159
|
+
c = Curl::Easy.new
|
160
|
+
c.url = "http://www.example.com"
|
161
|
+
c.post_body = "01234"
|
162
|
+
c.http_post
|
163
|
+
c.response_code.should == 200
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should work with blank arguments for put" do
|
167
|
+
stub_http_request(:put, "www.example.com").with(:body => "01234")
|
168
|
+
c = Curl::Easy.new
|
169
|
+
c.url = "http://www.example.com"
|
170
|
+
c.put_data = "01234"
|
171
|
+
c.http_put
|
172
|
+
c.response_code.should == 200
|
173
|
+
end
|
156
174
|
end
|
157
175
|
|
158
176
|
describe "using #perform for requests" do
|
@@ -30,5 +30,26 @@ unless RUBY_PLATFORM =~ /java/
|
|
30
30
|
http_request(:get, "http://www.example.com/?x=3", :query => "a[]=b&a[]=c").body.should == "abc"
|
31
31
|
end
|
32
32
|
|
33
|
+
describe "mocking EM::HttpClient API" do
|
34
|
+
before { stub_http_request(:get, "www.example.com/") }
|
35
|
+
subject do
|
36
|
+
client = nil
|
37
|
+
EM.run do
|
38
|
+
client = EventMachine::HttpRequest.new('http://www.example.com/').get
|
39
|
+
client.callback { EM.stop }
|
40
|
+
client.errback { failed }
|
41
|
+
end
|
42
|
+
client
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should support #uri' do
|
46
|
+
subject.uri.should == Addressable::URI.parse('http://www.example.com/')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should support #last_effective_url' do
|
50
|
+
subject.last_effective_url.should == Addressable::URI.parse('http://www.example.com/')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
33
54
|
end
|
34
55
|
end
|
data/webmock.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{webmock}
|
8
|
-
s.version = "1.6.
|
8
|
+
s.version = "1.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bartosz Blimke"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-12}
|
13
13
|
s.description = %q{WebMock allows stubbing HTTP requests and setting expectations on HTTP requests.}
|
14
14
|
s.email = %q{bartosz.blimke@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 1.6.
|
9
|
+
- 2
|
10
|
+
version: 1.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bartosz Blimke
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-12 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|