yajl-ruby 1.2.3 → 1.3.0

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.

Potentially problematic release.


This version of yajl-ruby might be problematic. Click here for more details.

@@ -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}')).should == {"key" => infinity}
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
- lambda {
14
+ expect {
22
15
  Yajl::Parser.parse(json, :allow_comments => false)
23
- }.should raise_error(Yajl::ParseError)
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
- lambda {
21
+ expect {
29
22
  Yajl::Parser.parse(json, :allow_comments => true)
30
- }.should_not raise_error
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
- lambda {
28
+ expect {
36
29
  parser.parse("[\"#{"\201\203"}\"]")
37
- }.should raise_error(Yajl::ParseError)
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).should == {"key" => 1234}
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).should == {:key => 1234}
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).should == {:"日本語" => 1234}
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}').should == {"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.should == {"key" => 1234}
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}").should eql({"id" => 2147483649})
72
- Yajl::Parser.parse("{\"id\": 5687389800}").should eql({"id" => 5687389800})
73
- Yajl::Parser.parse("{\"id\": 1046289770033519442869495707521600000000}").should eql({"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.should eq(Encoding::UTF_8)
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.should eql(Encoding.find('utf-8'))
85
- Yajl::Parser.parse('{"key": "value"}').values.first.encoding.should eql(Encoding.find('utf-8'))
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.should eql(Encoding.default_internal)
91
- Yajl::Parser.parse('{"key": "value"}').values.first.encoding.should eql(Encoding.default_internal)
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.should eql(Encoding.default_internal)
94
- Yajl::Parser.parse('{"key": "value"}').values.first.encoding.should eql(Encoding.default_internal)
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
@@ -13,4 +13,4 @@ begin
13
13
  task :default => :spec
14
14
  rescue LoadError
15
15
  puts "rspec, or one of its dependencies, is not available. Install it with: sudo gem install rspec"
16
- end
16
+ end
@@ -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', ">= 0.7.5"
21
- s.add_development_dependency 'rspec', "~> 2.14"
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.2.3
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: 2017-11-29 00:00:00.000000000 Z
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: '2.14'
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: '2.14'
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
- - MIT-LICENSE
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.11
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.
@@ -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.