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
@@ -2,39 +2,32 @@
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
3
3
|
|
4
4
|
describe "One-off JSON examples" do
|
5
|
-
it "should not blow up with a bad surrogate trailer" do
|
6
|
-
# https://github.com/brianmario/yajl-ruby/issues/176
|
7
|
-
bad_json = "{\"e\":{\"\\uD800\\\\DC00\":\"a\"}}"
|
8
|
-
|
9
|
-
Yajl::Parser.new.parse(bad_json)
|
10
|
-
end
|
11
|
-
|
12
5
|
it "should parse 23456789012E666 and return Infinity" do
|
13
6
|
infinity = (1.0/0)
|
14
7
|
silence_warnings do
|
15
|
-
Yajl::Parser.parse(StringIO.new('{"key": 23456789012E666}')).
|
8
|
+
expect(Yajl::Parser.parse(StringIO.new('{"key": 23456789012E666}'))).to eq({"key" => infinity})
|
16
9
|
end
|
17
10
|
end
|
18
11
|
|
19
12
|
it "should not parse JSON with a comment, with :allow_comments set to false" do
|
20
13
|
json = StringIO.new('{"key": /* this is a comment */ "value"}')
|
21
|
-
|
14
|
+
expect {
|
22
15
|
Yajl::Parser.parse(json, :allow_comments => false)
|
23
|
-
}.
|
16
|
+
}.to raise_error(Yajl::ParseError)
|
24
17
|
end
|
25
18
|
|
26
19
|
it "should parse JSON with a comment, with :allow_comments set to true" do
|
27
20
|
json = StringIO.new('{"key": /* this is a comment */ "value"}')
|
28
|
-
|
21
|
+
expect {
|
29
22
|
Yajl::Parser.parse(json, :allow_comments => true)
|
30
|
-
}.
|
23
|
+
}.not_to raise_error
|
31
24
|
end
|
32
25
|
|
33
26
|
it "should not parse invalid UTF8 with :check_utf8 set to true" do
|
34
27
|
parser = Yajl::Parser.new(:check_utf8 => true)
|
35
|
-
|
28
|
+
expect {
|
36
29
|
parser.parse("[\"#{"\201\203"}\"]")
|
37
|
-
}.
|
30
|
+
}.to raise_error(Yajl::ParseError)
|
38
31
|
end
|
39
32
|
|
40
33
|
it "should parse invalid UTF8 with :check_utf8 set to false" do
|
@@ -44,19 +37,19 @@ describe "One-off JSON examples" do
|
|
44
37
|
|
45
38
|
it "should parse using it's class method, from an IO" do
|
46
39
|
io = StringIO.new('{"key": 1234}')
|
47
|
-
Yajl::Parser.parse(io).
|
40
|
+
expect(Yajl::Parser.parse(io)).to eq({"key" => 1234})
|
48
41
|
end
|
49
42
|
|
50
43
|
it "should parse using it's class method, from a string with symbolized keys" do
|
51
|
-
Yajl::Parser.parse('{"key": 1234}', :symbolize_keys => true).
|
44
|
+
expect(Yajl::Parser.parse('{"key": 1234}', :symbolize_keys => true)).to eq({:key => 1234})
|
52
45
|
end
|
53
46
|
|
54
47
|
it "should parse using it's class method, from a utf-8 string with multibyte characters, with symbolized keys" do
|
55
|
-
Yajl::Parser.parse('{"日本語": 1234}', :symbolize_keys => true).
|
48
|
+
expect(Yajl::Parser.parse('{"日本語": 1234}', :symbolize_keys => true)).to eq({:"日本語" => 1234})
|
56
49
|
end
|
57
50
|
|
58
51
|
it "should parse using it's class method, from a string" do
|
59
|
-
Yajl::Parser.parse('{"key": 1234}').
|
52
|
+
expect(Yajl::Parser.parse('{"key": 1234}')).to eq({"key" => 1234})
|
60
53
|
end
|
61
54
|
|
62
55
|
it "should parse using it's class method, from a string with a block" do
|
@@ -64,34 +57,34 @@ describe "One-off JSON examples" do
|
|
64
57
|
Yajl::Parser.parse('{"key": 1234}') do |obj|
|
65
58
|
output = obj
|
66
59
|
end
|
67
|
-
output.
|
60
|
+
expect(output).to eq({"key" => 1234})
|
68
61
|
end
|
69
62
|
|
70
63
|
it "should parse numbers greater than 2,147,483,648" do
|
71
|
-
Yajl::Parser.parse("{\"id\": 2147483649}").
|
72
|
-
Yajl::Parser.parse("{\"id\": 5687389800}").
|
73
|
-
Yajl::Parser.parse("{\"id\": 1046289770033519442869495707521600000000}").
|
64
|
+
expect(Yajl::Parser.parse("{\"id\": 2147483649}")).to eql({"id" => 2147483649})
|
65
|
+
expect(Yajl::Parser.parse("{\"id\": 5687389800}")).to eql({"id" => 5687389800})
|
66
|
+
expect(Yajl::Parser.parse("{\"id\": 1046289770033519442869495707521600000000}")).to eql({"id" => 1046289770033519442869495707521600000000})
|
74
67
|
end
|
75
68
|
|
76
69
|
if RUBY_VERSION =~ /^1.9/
|
77
70
|
it "should encode non-ascii symbols in utf-8" do
|
78
71
|
parsed = Yajl::Parser.parse('{"曦": 1234}', :symbolize_keys => true)
|
79
|
-
parsed.keys.fetch(0).encoding.
|
72
|
+
expect(parsed.keys.fetch(0).encoding).to eq(Encoding::UTF_8)
|
80
73
|
end
|
81
74
|
|
82
75
|
it "should return strings and hash keys in utf-8 if Encoding.default_internal is nil" do
|
83
76
|
Encoding.default_internal = nil
|
84
|
-
Yajl::Parser.parse('{"key": "value"}').keys.first.encoding.
|
85
|
-
Yajl::Parser.parse('{"key": "value"}').values.first.encoding.
|
77
|
+
expect(Yajl::Parser.parse('{"key": "value"}').keys.first.encoding).to eql(Encoding.find('utf-8'))
|
78
|
+
expect(Yajl::Parser.parse('{"key": "value"}').values.first.encoding).to eql(Encoding.find('utf-8'))
|
86
79
|
end
|
87
80
|
|
88
81
|
it "should return strings and hash keys encoded as specified in Encoding.default_internal if it's set" do
|
89
82
|
Encoding.default_internal = Encoding.find('utf-8')
|
90
|
-
Yajl::Parser.parse('{"key": "value"}').keys.first.encoding.
|
91
|
-
Yajl::Parser.parse('{"key": "value"}').values.first.encoding.
|
83
|
+
expect(Yajl::Parser.parse('{"key": "value"}').keys.first.encoding).to eql(Encoding.default_internal)
|
84
|
+
expect(Yajl::Parser.parse('{"key": "value"}').values.first.encoding).to eql(Encoding.default_internal)
|
92
85
|
Encoding.default_internal = Encoding.find('us-ascii')
|
93
|
-
Yajl::Parser.parse('{"key": "value"}').keys.first.encoding.
|
94
|
-
Yajl::Parser.parse('{"key": "value"}').values.first.encoding.
|
86
|
+
expect(Yajl::Parser.parse('{"key": "value"}').keys.first.encoding).to eql(Encoding.default_internal)
|
87
|
+
expect(Yajl::Parser.parse('{"key": "value"}').values.first.encoding).to eql(Encoding.default_internal)
|
95
88
|
end
|
96
89
|
end
|
97
90
|
end
|
data/tasks/rspec.rake
CHANGED
data/yajl-ruby.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.required_ruby_version = ">= 1.8.6"
|
18
18
|
|
19
19
|
# tests
|
20
|
-
s.add_development_dependency 'rake-compiler',
|
21
|
-
s.add_development_dependency 'rspec',
|
20
|
+
s.add_development_dependency 'rake-compiler', '>= 0.7.5'
|
21
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
22
22
|
# benchmarks
|
23
23
|
s.add_development_dependency 'activesupport', '~> 3.1.2'
|
24
24
|
s.add_development_dependency 'json'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yajl-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '3.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '3.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: activesupport
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,12 +74,13 @@ extensions:
|
|
74
74
|
- ext/yajl/extconf.rb
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".codeclimate.yml"
|
77
78
|
- ".gitignore"
|
78
79
|
- ".rspec"
|
79
80
|
- ".travis.yml"
|
80
81
|
- CHANGELOG.md
|
81
82
|
- Gemfile
|
82
|
-
-
|
83
|
+
- LICENSE
|
83
84
|
- README.md
|
84
85
|
- Rakefile
|
85
86
|
- benchmark/encode.rb
|
@@ -245,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
246
|
version: '0'
|
246
247
|
requirements: []
|
247
248
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.6.
|
249
|
+
rubygems_version: 2.6.3
|
249
250
|
signing_key:
|
250
251
|
specification_version: 4
|
251
252
|
summary: Ruby C bindings to the excellent Yajl JSON stream-based parser library.
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008-2011 Brian Lopez - http://github.com/brianmario
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|