yajl-ruby 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yajl-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.codeclimate.yml +40 -0
- data/.travis.yml +3 -7
- data/LICENSE +21 -0
- data/examples/encoding/chunked_encoding.rb +1 -1
- data/examples/encoding/one_shot.rb +1 -1
- data/examples/encoding/to_an_io.rb +1 -1
- data/examples/http/twitter_search_api.rb +1 -1
- data/examples/http/twitter_stream_api.rb +1 -1
- data/examples/parsing/from_file.rb +1 -1
- data/examples/parsing/from_stdin.rb +1 -1
- data/examples/parsing/from_string.rb +1 -1
- data/ext/yajl/yajl_encode.c +2 -2
- data/lib/yajl.rb +2 -2
- data/lib/yajl/version.rb +1 -1
- data/spec/encoding/encoding_spec.rb +45 -45
- data/spec/global/global_spec.rb +10 -10
- data/spec/http/http_delete_spec.rb +15 -15
- data/spec/http/http_error_spec.rb +7 -8
- data/spec/http/http_get_spec.rb +17 -17
- data/spec/http/http_post_spec.rb +19 -19
- data/spec/http/http_put_spec.rb +16 -16
- data/spec/http/http_stream_options_spec.rb +4 -4
- data/spec/json_gem_compatibility/compatibility_spec.rb +70 -70
- data/spec/parsing/active_support_spec.rb +10 -10
- data/spec/parsing/chunked_spec.rb +18 -18
- data/spec/parsing/fixtures_spec.rb +8 -8
- data/spec/parsing/large_number_spec.rb +1 -1
- data/spec/parsing/one_off_spec.rb +22 -29
- data/tasks/rspec.rake +1 -1
- data/yajl-ruby.gemspec +2 -2
- metadata +7 -6
- data/MIT-LICENSE +0 -20
data/spec/global/global_spec.rb
CHANGED
@@ -3,52 +3,52 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
|
3
3
|
describe "Yajl" do
|
4
4
|
context "dump" do
|
5
5
|
it "should exist as a class-method" do
|
6
|
-
Yajl.
|
6
|
+
expect(Yajl).to respond_to(:dump)
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should be able to encode to a string" do
|
10
|
-
Yajl.dump({:a => 1234}).
|
10
|
+
expect(Yajl.dump({:a => 1234})).to eql('{"a":1234}')
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should be able to encode to an IO" do
|
14
14
|
io = StringIO.new
|
15
15
|
Yajl.dump({:a => 1234}, io)
|
16
16
|
io.rewind
|
17
|
-
io.read.
|
17
|
+
expect(io.read).to eql('{"a":1234}')
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should be able to encode with a block supplied" do
|
21
21
|
Yajl.dump({:a => 1234}) do |chunk|
|
22
|
-
chunk.
|
22
|
+
expect(chunk).to eql('{"a":1234}')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context "load" do
|
28
28
|
it "should exist as a class-method" do
|
29
|
-
Yajl.
|
29
|
+
expect(Yajl).to respond_to(:load)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should be able to parse from a string" do
|
33
|
-
Yajl.load('{"a":1234}').
|
33
|
+
expect(Yajl.load('{"a":1234}')).to eql({"a" => 1234})
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should be able to parse from an IO" do
|
37
37
|
io = StringIO.new('{"a":1234}')
|
38
|
-
Yajl.load(io).
|
38
|
+
expect(Yajl.load(io)).to eql({"a" => 1234})
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should be able to parse from a string with a block supplied" do
|
42
42
|
Yajl.load('{"a":1234}') do |h|
|
43
|
-
h.
|
43
|
+
expect(h).to eql({"a" => 1234})
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should be able to parse from an IO with a block supplied" do
|
48
48
|
io = StringIO.new('{"a":1234}')
|
49
49
|
Yajl.load(io) do |h|
|
50
|
-
h.
|
50
|
+
expect(h).to eql({"a" => 1234})
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
@@ -37,62 +37,62 @@ describe "Yajl HTTP DELETE request" do
|
|
37
37
|
def prepare_mock_request_dump(format=:raw)
|
38
38
|
@request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.#{format}.dump"), 'r')
|
39
39
|
@uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.#{format}.dump")
|
40
|
-
TCPSocket.
|
41
|
-
@request.
|
40
|
+
expect(TCPSocket).to receive(:new).and_return(@request)
|
41
|
+
expect(@request).to receive(:write)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should parse a raw response" do
|
45
45
|
prepare_mock_request_dump :raw
|
46
|
-
@template_hash.
|
46
|
+
expect(@template_hash).to eq(Yajl::HttpStream.delete(@uri))
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should parse a raw response using instance method" do
|
50
50
|
prepare_mock_request_dump :raw
|
51
|
-
@uri.
|
52
|
-
@uri.
|
51
|
+
expect(@uri).to receive(:host)
|
52
|
+
expect(@uri).to receive(:port)
|
53
53
|
stream = Yajl::HttpStream.new
|
54
|
-
@template_hash.
|
54
|
+
expect(@template_hash).to eq(stream.delete(@uri))
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should parse a raw response and symbolize keys" do
|
58
58
|
prepare_mock_request_dump :raw
|
59
|
-
@template_hash_symbolized.
|
59
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.delete(@uri, :symbolize_keys => true))
|
60
60
|
end
|
61
61
|
|
62
62
|
if defined?(Yajl::Bzip2::StreamReader)
|
63
63
|
it "should parse a bzip2 compressed response" do
|
64
64
|
prepare_mock_request_dump :bzip2
|
65
|
-
@template_hash.
|
65
|
+
expect(@template_hash).to eq(Yajl::HttpStream.delete(@uri))
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should parse a bzip2 compressed response and symbolize keys" do
|
69
69
|
prepare_mock_request_dump :bzip2
|
70
|
-
@template_hash_symbolized.
|
70
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.delete(@uri, :symbolize_keys => true))
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should parse a deflate compressed response" do
|
75
75
|
prepare_mock_request_dump :deflate
|
76
|
-
@template_hash.
|
76
|
+
expect(@template_hash).to eq(Yajl::HttpStream.delete(@uri))
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should parse a deflate compressed response and symbolize keys" do
|
80
80
|
prepare_mock_request_dump :deflate
|
81
|
-
@template_hash_symbolized.
|
81
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.delete(@uri, :symbolize_keys => true))
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should parse a gzip compressed response" do
|
85
85
|
prepare_mock_request_dump :gzip
|
86
|
-
@template_hash.
|
86
|
+
expect(@template_hash).to eq(Yajl::HttpStream.delete(@uri))
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should parse a gzip compressed response and symbolize keys" do
|
90
90
|
prepare_mock_request_dump :gzip
|
91
|
-
@template_hash_symbolized.
|
91
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.delete(@uri, :symbolize_keys => true))
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should raise when an HTTP code that isn't 200 is returned" do
|
95
95
|
prepare_mock_request_dump :error
|
96
|
-
|
96
|
+
expect { Yajl::HttpStream.delete(@uri) }.to raise_exception(Yajl::HttpStream::HttpError)
|
97
97
|
end
|
98
|
-
end
|
98
|
+
end
|
@@ -9,12 +9,11 @@ require 'yajl/deflate'
|
|
9
9
|
require 'yajl/http_stream'
|
10
10
|
|
11
11
|
describe "Yajl HTTP error" do
|
12
|
-
before
|
12
|
+
before do
|
13
|
+
@uri = 'file://' + File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.error.dump")
|
13
14
|
@request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.error.dump"), 'r')
|
14
|
-
|
15
|
-
|
16
|
-
@request.should_receive(:write)
|
17
|
-
|
15
|
+
allow(TCPSocket).to receive(:new).and_return(@request)
|
16
|
+
allow(@request).to receive(:write)
|
18
17
|
begin
|
19
18
|
Yajl::HttpStream.get(@uri)
|
20
19
|
rescue Yajl::HttpStream::HttpError => e
|
@@ -23,10 +22,10 @@ describe "Yajl HTTP error" do
|
|
23
22
|
end
|
24
23
|
|
25
24
|
it "should contain the error code in the message" do
|
26
|
-
@error.message.
|
25
|
+
expect(@error.message).to match(/404/)
|
27
26
|
end
|
28
27
|
|
29
28
|
it "should provide the HTTP response headers" do
|
30
|
-
@error.headers.keys.
|
29
|
+
expect(@error.headers.keys).to include('ETag', 'Content-Length', 'Server')
|
31
30
|
end
|
32
|
-
end
|
31
|
+
end
|
data/spec/http/http_get_spec.rb
CHANGED
@@ -38,72 +38,72 @@ describe "Yajl HTTP GET request" do
|
|
38
38
|
def prepare_mock_request_dump(format=:raw)
|
39
39
|
@request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.#{format}.dump"), 'r')
|
40
40
|
@uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.#{format}.dump")
|
41
|
-
TCPSocket.
|
42
|
-
@request.
|
41
|
+
expect(TCPSocket).to receive(:new).and_return(@request)
|
42
|
+
expect(@request).to receive(:write)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should parse a raw response" do
|
46
46
|
prepare_mock_request_dump :raw
|
47
|
-
@template_hash.
|
47
|
+
expect(@template_hash).to eq(Yajl::HttpStream.get(@uri))
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should parse a raw response and symbolize keys" do
|
51
51
|
prepare_mock_request_dump :raw
|
52
|
-
@template_hash_symbolized.
|
52
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.get(@uri, :symbolize_keys => true))
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should parse a raw response using instance method" do
|
56
56
|
prepare_mock_request_dump :raw
|
57
|
-
@uri.
|
58
|
-
@uri.
|
57
|
+
expect(@uri).to receive(:host)
|
58
|
+
expect(@uri).to receive(:port)
|
59
59
|
stream = Yajl::HttpStream.new
|
60
|
-
@template_hash.
|
60
|
+
expect(@template_hash).to eq(stream.get(@uri))
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should parse a chunked response using instance method" do
|
64
64
|
prepare_mock_request_dump :chunked
|
65
|
-
@uri.
|
66
|
-
@uri.
|
65
|
+
expect(@uri).to receive(:host)
|
66
|
+
expect(@uri).to receive(:port)
|
67
67
|
stream = Yajl::HttpStream.new
|
68
68
|
stream.get(@uri) do |obj|
|
69
|
-
obj.
|
69
|
+
expect(obj).to eql(@chunked_body)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
if defined?(Yajl::Bzip2::StreamReader)
|
74
74
|
it "should parse a bzip2 compressed response" do
|
75
75
|
prepare_mock_request_dump :bzip2
|
76
|
-
@template_hash.
|
76
|
+
expect(@template_hash).to eq(Yajl::HttpStream.get(@uri))
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should parse a bzip2 compressed response and symbolize keys" do
|
80
80
|
prepare_mock_request_dump :bzip2
|
81
|
-
@template_hash_symbolized.
|
81
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.get(@uri, :symbolize_keys => true))
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
it "should parse a deflate compressed response" do
|
86
86
|
prepare_mock_request_dump :deflate
|
87
|
-
@template_hash.
|
87
|
+
expect(@template_hash).to eq(Yajl::HttpStream.get(@uri))
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should parse a deflate compressed response and symbolize keys" do
|
91
91
|
prepare_mock_request_dump :deflate
|
92
|
-
@template_hash_symbolized.
|
92
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.get(@uri, :symbolize_keys => true))
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should parse a gzip compressed response" do
|
96
96
|
prepare_mock_request_dump :gzip
|
97
|
-
@template_hash.
|
97
|
+
expect(@template_hash).to eq(Yajl::HttpStream.get(@uri))
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should parse a gzip compressed response and symbolize keys" do
|
101
101
|
prepare_mock_request_dump :gzip
|
102
|
-
@template_hash_symbolized.
|
102
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.get(@uri, :symbolize_keys => true))
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should raise when an HTTP code that isn't 200 is returned" do
|
106
106
|
prepare_mock_request_dump :error
|
107
|
-
|
107
|
+
expect { Yajl::HttpStream.get(@uri) }.to raise_exception(Yajl::HttpStream::HttpError)
|
108
108
|
end
|
109
109
|
end
|
data/spec/http/http_post_spec.rb
CHANGED
@@ -40,84 +40,84 @@ describe "Yajl HTTP POST request" do
|
|
40
40
|
def prepare_mock_request_dump(format=:raw)
|
41
41
|
@request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.#{format}.dump"), 'r')
|
42
42
|
@uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.#{format}.dump")
|
43
|
-
TCPSocket.
|
44
|
-
@request.
|
43
|
+
expect(TCPSocket).to receive(:new).and_return(@request)
|
44
|
+
expect(@request).to receive(:write)
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should parse a raw response" do
|
48
48
|
prepare_mock_request_dump :raw
|
49
|
-
@template_hash.
|
49
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @body))
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should parse a raw response using instance method" do
|
53
53
|
prepare_mock_request_dump :raw
|
54
|
-
@uri.
|
55
|
-
@uri.
|
54
|
+
expect(@uri).to receive(:host)
|
55
|
+
expect(@uri).to receive(:port)
|
56
56
|
stream = Yajl::HttpStream.new
|
57
|
-
@template_hash.
|
57
|
+
expect(@template_hash).to eq(stream.post(@uri, @body))
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should parse a raw response with hashed body" do
|
61
61
|
prepare_mock_request_dump :raw
|
62
|
-
@template_hash.
|
62
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @hashed_body))
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should parse a raw response and symbolize keys" do
|
66
66
|
prepare_mock_request_dump :raw
|
67
|
-
@template_hash_symbolized.
|
67
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true))
|
68
68
|
end
|
69
69
|
|
70
70
|
if defined?(Yajl::Bzip2::StreamReader)
|
71
71
|
it "should parse a bzip2 compressed response" do
|
72
72
|
prepare_mock_request_dump :bzip2
|
73
|
-
@template_hash.
|
73
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @body))
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should parse a bzip2 compressed response and symbolize keys" do
|
77
77
|
prepare_mock_request_dump :bzip2
|
78
|
-
@template_hash_symbolized.
|
78
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true))
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should parse a deflate compressed response" do
|
83
83
|
prepare_mock_request_dump :deflate
|
84
|
-
@template_hash.
|
84
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @body))
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should parse a deflate compressed response and symbolize keys" do
|
88
88
|
prepare_mock_request_dump :deflate
|
89
|
-
@template_hash_symbolized.
|
89
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true))
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should parse a gzip compressed response" do
|
93
93
|
prepare_mock_request_dump :gzip
|
94
|
-
@template_hash.
|
94
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @body))
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should parse a gzip compressed response and symbolize keys" do
|
98
98
|
prepare_mock_request_dump :gzip
|
99
|
-
@template_hash_symbolized.
|
99
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true))
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should parse a chunked raw response" do
|
103
103
|
prepare_mock_request_dump :chunked
|
104
104
|
Yajl::HttpStream.post(@uri, @body) do |obj|
|
105
|
-
obj.
|
105
|
+
expect(obj).to eql(@chunked_body)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should throw Exception if chunked response and no block given" do
|
110
110
|
prepare_mock_request_dump :chunked
|
111
|
-
|
111
|
+
expect {Yajl::HttpStream.post(@uri, @body)}.to raise_error(Exception)
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should throw InvalidContentType if unable to handle the MIME type" do
|
115
115
|
prepare_mock_request_dump :html
|
116
|
-
|
116
|
+
expect {Yajl::HttpStream.post(@uri, @body)}.to raise_error(Yajl::HttpStream::InvalidContentType)
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should raise when an HTTP code that isn't 200 is returned" do
|
120
120
|
prepare_mock_request_dump :error
|
121
|
-
|
121
|
+
expect { Yajl::HttpStream.post(@uri, @body) }.to raise_exception(Yajl::HttpStream::HttpError)
|
122
122
|
end
|
123
|
-
end
|
123
|
+
end
|
data/spec/http/http_put_spec.rb
CHANGED
@@ -39,67 +39,67 @@ describe "Yajl HTTP PUT request" do
|
|
39
39
|
def prepare_mock_request_dump(format=:raw)
|
40
40
|
@request = File.new(File.expand_path(File.dirname(__FILE__) + "/fixtures/http.#{format}.dump"), 'r')
|
41
41
|
@uri = 'file://'+File.expand_path(File.dirname(__FILE__) + "/fixtures/http/http.#{format}.dump")
|
42
|
-
TCPSocket.
|
43
|
-
@request.
|
42
|
+
expect(TCPSocket).to receive(:new).and_return(@request)
|
43
|
+
expect(@request).to receive(:write)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should parse a raw response" do
|
47
47
|
prepare_mock_request_dump :raw
|
48
|
-
@template_hash.
|
48
|
+
expect(@template_hash).to eq(Yajl::HttpStream.put(@uri, @body))
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should parse a raw response using instance method" do
|
52
52
|
prepare_mock_request_dump :raw
|
53
|
-
@uri.
|
54
|
-
@uri.
|
53
|
+
expect(@uri).to receive(:host)
|
54
|
+
expect(@uri).to receive(:port)
|
55
55
|
stream = Yajl::HttpStream.new
|
56
|
-
@template_hash.
|
56
|
+
expect(@template_hash).to eq(stream.put(@uri, @body))
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should parse a raw response with hashed body" do
|
60
60
|
prepare_mock_request_dump :raw
|
61
|
-
@template_hash.
|
61
|
+
expect(@template_hash).to eq(Yajl::HttpStream.post(@uri, @hashed_body))
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should parse a raw response and symbolize keys" do
|
65
65
|
prepare_mock_request_dump :raw
|
66
|
-
@template_hash_symbolized.
|
66
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true))
|
67
67
|
end
|
68
68
|
|
69
69
|
if defined?(Yajl::Bzip2::StreamReader)
|
70
70
|
it "should parse a bzip2 compressed response" do
|
71
71
|
prepare_mock_request_dump :bzip2
|
72
|
-
@template_hash.
|
72
|
+
expect(@template_hash).to eq(Yajl::HttpStream.put(@uri, @body))
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should parse a bzip2 compressed response and symbolize keys" do
|
76
76
|
prepare_mock_request_dump :bzip2
|
77
|
-
@template_hash_symbolized.
|
77
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true))
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should parse a deflate compressed response" do
|
82
82
|
prepare_mock_request_dump :deflate
|
83
|
-
@template_hash.
|
83
|
+
expect(@template_hash).to eq(Yajl::HttpStream.put(@uri, @body))
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should parse a deflate compressed response and symbolize keys" do
|
87
87
|
prepare_mock_request_dump :deflate
|
88
|
-
@template_hash_symbolized.
|
88
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true))
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should parse a gzip compressed response" do
|
92
92
|
prepare_mock_request_dump :gzip
|
93
|
-
@template_hash.
|
93
|
+
expect(@template_hash).to eq(Yajl::HttpStream.put(@uri, @body))
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should parse a gzip compressed response and symbolize keys" do
|
97
97
|
prepare_mock_request_dump :gzip
|
98
|
-
@template_hash_symbolized.
|
98
|
+
expect(@template_hash_symbolized).to eq(Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true))
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should raise when an HTTP code that isn't 200 is returned" do
|
102
102
|
prepare_mock_request_dump :error
|
103
|
-
|
103
|
+
expect { Yajl::HttpStream.put(@uri, @body) }.to raise_exception(Yajl::HttpStream::HttpError)
|
104
104
|
end
|
105
|
-
end
|
105
|
+
end
|