webmock 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  #Changelog
2
2
 
3
+ ## 1.3.1
4
+
5
+ * The less hacky way to get the stream behaviour working for em-http-request. Thanks to Martyn Loughran
6
+
7
+ * Fixed issues where Net::HTTP was not accepting valid nil response body. Thanks to Muness Alrubaie
8
+
3
9
  ## 1.3.0
4
10
 
5
11
  * Added support for [em-http-request](http://github.com/igrigorik/em-http-request)
@@ -13,6 +19,7 @@
13
19
  request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made # ===> Success
14
20
 
15
21
  * Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
22
+
16
23
  (Thanks to Steve Tooke for the idea and a solution for url-encoded bodies)
17
24
 
18
25
  stub_http_request(:post, "www.example.com").
@@ -51,7 +58,7 @@
51
58
 
52
59
  stub_request(:any, 'www.example.net').to_raise("some error")
53
60
 
54
- * Matching request stubs based on a URI is 30% faster
61
+ * Matching requests based on a URI is 30% faster
55
62
 
56
63
  * Fixed constant namespace issues in HTTPClient adapter. Thanks to Nathaniel Bibler for submitting a patch.
57
64
 
data/README.md CHANGED
@@ -498,6 +498,8 @@ People who submitted patches and new features or suggested improvements. Many th
498
498
  * Razic
499
499
  * Steve Tooke
500
500
  * Nathaniel Bibler
501
+ * Martyn Loughran
502
+ * Muness Alrubaie
501
503
 
502
504
  ## Background
503
505
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -11,14 +11,16 @@ if defined?(EventMachine::HttpRequest)
11
11
  on_error(error)
12
12
  fail(self)
13
13
  else
14
- receive_data(response)
15
- succeed(self)
14
+ EM.next_tick do
15
+ receive_data(response)
16
+ succeed(self)
17
+ end
16
18
  end
17
19
  end
18
20
 
19
- def stream(&blk)
20
- blk.call(@response)
21
- end
21
+ # def stream(&blk)
22
+ # blk.call(@response)
23
+ # end
22
24
 
23
25
  def unbind
24
26
  end
@@ -19,6 +19,7 @@ module WebMock
19
19
  object.instance_variable_set(:@__orig_body__,
20
20
  case body_object
21
21
  when String then body_object
22
+ when nil then nil
22
23
  else raise ArgumentError.new("Unexpected body object: #{body_object}")
23
24
  end
24
25
  )
@@ -21,17 +21,10 @@ module EMHttpRequestSpecHelper
21
21
  error = http.errors
22
22
  failed
23
23
  }
24
- headers = {}
25
- if http.response_header
26
- http.response_header.each do |k,v|
27
- v = v.join(", ") if v.is_a?(Array)
28
- headers[k] = v
29
- end
30
- end
31
- http.callback {
24
+ http.callback {
32
25
  response = OpenStruct.new({
33
26
  :body => http.response,
34
- :headers => WebMock::Util::Headers.normalize_headers(headers),
27
+ :headers => WebMock::Util::Headers.normalize_headers(extract_response_headers(http)),
35
28
  :message => http.response_header.http_reason,
36
29
  :status => http.response_header.status.to_s
37
30
  })
@@ -60,5 +53,18 @@ module EMHttpRequestSpecHelper
60
53
  def http_library
61
54
  :em_http_request
62
55
  end
56
+
57
+ private
58
+
59
+ def extract_response_headers(http)
60
+ headers = {}
61
+ if http.response_header
62
+ http.response_header.each do |k,v|
63
+ v = v.join(", ") if v.is_a?(Array)
64
+ headers[k] = v
65
+ end
66
+ end
67
+ headers
68
+ end
63
69
 
64
70
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webmock}
8
- s.version = "1.3.0"
8
+ s.version = "1.3.1"
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{2010-06-21}
12
+ s.date = %q{2010-07-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 = [
@@ -89,7 +89,7 @@ Gem::Specification.new do |s|
89
89
  s.homepage = %q{http://github.com/bblimke/webmock}
90
90
  s.rdoc_options = ["--charset=UTF-8"]
91
91
  s.require_paths = ["lib"]
92
- s.rubygems_version = %q{1.3.7}
92
+ s.rubygems_version = %q{1.3.6}
93
93
  s.summary = %q{Library for stubbing HTTP requests in Ruby.}
94
94
  s.test_files = [
95
95
  "spec/benchmark.rb",
@@ -127,7 +127,7 @@ Gem::Specification.new do |s|
127
127
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
128
128
  s.specification_version = 3
129
129
 
130
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
130
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
131
131
  s.add_runtime_dependency(%q<addressable>, [">= 2.1.1"])
132
132
  s.add_runtime_dependency(%q<crack>, [">= 0.1.7"])
133
133
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 3
8
- - 0
9
- version: 1.3.0
8
+ - 1
9
+ version: 1.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bartosz Blimke
@@ -14,14 +14,13 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-21 00:00:00 +01:00
17
+ date: 2010-07-12 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: addressable
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
@@ -36,7 +35,6 @@ dependencies:
36
35
  name: crack
37
36
  prerelease: false
38
37
  requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
@@ -51,7 +49,6 @@ dependencies:
51
49
  name: rspec
52
50
  prerelease: false
53
51
  requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
52
  requirements:
56
53
  - - ">="
57
54
  - !ruby/object:Gem::Version
@@ -66,7 +63,6 @@ dependencies:
66
63
  name: httpclient
67
64
  prerelease: false
68
65
  requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
66
  requirements:
71
67
  - - ">="
72
68
  - !ruby/object:Gem::Version
@@ -82,7 +78,6 @@ dependencies:
82
78
  name: patron
83
79
  prerelease: false
84
80
  requirement: &id005 !ruby/object:Gem::Requirement
85
- none: false
86
81
  requirements:
87
82
  - - ">="
88
83
  - !ruby/object:Gem::Version
@@ -97,7 +92,6 @@ dependencies:
97
92
  name: em-http-request
98
93
  prerelease: false
99
94
  requirement: &id006 !ruby/object:Gem::Requirement
100
- none: false
101
95
  requirements:
102
96
  - - ">="
103
97
  - !ruby/object:Gem::Version
@@ -186,7 +180,6 @@ files:
186
180
  - test/test_helper.rb
187
181
  - test/test_webmock.rb
188
182
  - webmock.gemspec
189
- - spec/benchmark.rb
190
183
  has_rdoc: true
191
184
  homepage: http://github.com/bblimke/webmock
192
185
  licenses: []
@@ -197,7 +190,6 @@ rdoc_options:
197
190
  require_paths:
198
191
  - lib
199
192
  required_ruby_version: !ruby/object:Gem::Requirement
200
- none: false
201
193
  requirements:
202
194
  - - ">="
203
195
  - !ruby/object:Gem::Version
@@ -205,7 +197,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
197
  - 0
206
198
  version: "0"
207
199
  required_rubygems_version: !ruby/object:Gem::Requirement
208
- none: false
209
200
  requirements:
210
201
  - - ">="
211
202
  - !ruby/object:Gem::Version
@@ -215,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
206
  requirements: []
216
207
 
217
208
  rubyforge_project:
218
- rubygems_version: 1.3.7
209
+ rubygems_version: 1.3.6
219
210
  signing_key:
220
211
  specification_version: 3
221
212
  summary: Library for stubbing HTTP requests in Ruby.