webmock 0.8.1 → 0.8.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 +4 -0
- data/VERSION +1 -1
- data/lib/webmock/response.rb +10 -4
- data/spec/webmock_spec.rb +5 -0
- data/test/test_webmock.rb +1 -1
- data/webmock.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.8.2
|
2
|
+
* Fixed issue where WebMock was not closing IO object passed as response body after reading it.
|
3
|
+
* Ruby 1.9.2 compat: Use File#expand_path for require path because "." will not be included in LOAD_PATH since Ruby 1.9.2
|
4
|
+
|
1
5
|
== 0.8.1
|
2
6
|
* Fixed HTTPClient adapter compatibility with Ruby 1.8.6 (reported by Piotr Usewicz)
|
3
7
|
* Net:HTTP adapter now handles request body assigned as Net::HTTP::Post#body attribute (fixed by Mack Earnhardt)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.2
|
data/lib/webmock/response.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module WebMock
|
2
2
|
class Response
|
3
|
-
|
3
|
+
attr_reader :options
|
4
4
|
|
5
5
|
def initialize(options = {})
|
6
|
-
|
6
|
+
self.options = options
|
7
7
|
@options[:headers] = Util::Headers.normalize_headers(@options[:headers]) unless @options[:headers].is_a?(Proc)
|
8
8
|
end
|
9
9
|
|
@@ -25,8 +25,12 @@ module WebMock
|
|
25
25
|
raise @options[:exception].new('Exception from WebMock') if @options.has_key?(:exception)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def options=(options)
|
29
|
+
@options = options
|
29
30
|
stringify_body!
|
31
|
+
end
|
32
|
+
|
33
|
+
def dup
|
30
34
|
dup_response = super
|
31
35
|
dup_response.options = options.dup
|
32
36
|
dup_response
|
@@ -38,7 +42,9 @@ module WebMock
|
|
38
42
|
|
39
43
|
def stringify_body!
|
40
44
|
if @options[:body].is_a?(IO)
|
41
|
-
|
45
|
+
io = @options[:body]
|
46
|
+
@options[:body] = io.read
|
47
|
+
io.close
|
42
48
|
end
|
43
49
|
end
|
44
50
|
|
data/spec/webmock_spec.rb
CHANGED
@@ -232,6 +232,11 @@ describe "WebMock", :shared => true do
|
|
232
232
|
end
|
233
233
|
end
|
234
234
|
|
235
|
+
it "should close IO declared as response body after reading" do
|
236
|
+
stub_http_request(:get, "www.example.com").to_return(:body => @file = File.new(__FILE__))
|
237
|
+
@file.should be_closed
|
238
|
+
end
|
239
|
+
|
235
240
|
describe "dynamic responses" do
|
236
241
|
|
237
242
|
it "should return evaluated response body" do
|
data/test/test_webmock.rb
CHANGED
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 = "0.8.
|
8
|
+
s.version = "0.8.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{2010-01-
|
12
|
+
s.date = %q{2010-01-17}
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-17 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|