yajl-ruby 0.6.3 → 0.6.4

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.

@@ -1,6 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
3
- require 'yajl/bzip2'
3
+ begin
4
+ require 'yajl/bzip2'
5
+ rescue
6
+ warn "Couldn't load yajl/bzip2, maybe you don't have bzip2-ruby installed? Continuing without running bzip2 specs."
7
+ end
4
8
  require 'yajl/gzip'
5
9
  require 'yajl/deflate'
6
10
  require 'yajl/http_stream'
@@ -53,14 +57,16 @@ describe "Yajl HTTP DELETE request" do
53
57
  @template_hash_symbolized.should == Yajl::HttpStream.delete(@uri, :symbolize_keys => true)
54
58
  end
55
59
 
56
- it "should parse a bzip2 compressed response" do
57
- prepare_mock_request_dump :bzip2
58
- @template_hash.should == Yajl::HttpStream.delete(@uri)
59
- end
60
-
61
- it "should parse a bzip2 compressed response and symbolize keys" do
62
- prepare_mock_request_dump :bzip2
63
- @template_hash_symbolized.should == Yajl::HttpStream.delete(@uri, :symbolize_keys => true)
60
+ if defined?(Yajl::Bzip2::StreamReader)
61
+ it "should parse a bzip2 compressed response" do
62
+ prepare_mock_request_dump :bzip2
63
+ @template_hash.should == Yajl::HttpStream.delete(@uri)
64
+ end
65
+
66
+ it "should parse a bzip2 compressed response and symbolize keys" do
67
+ prepare_mock_request_dump :bzip2
68
+ @template_hash_symbolized.should == Yajl::HttpStream.delete(@uri, :symbolize_keys => true)
69
+ end
64
70
  end
65
71
 
66
72
  it "should parse a deflate compressed response" do
@@ -1,6 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
3
- require 'yajl/bzip2'
3
+ begin
4
+ require 'yajl/bzip2'
5
+ rescue
6
+ warn "Couldn't load yajl/bzip2, maybe you don't have bzip2-ruby installed? Continuing without running bzip2 specs."
7
+ end
4
8
  require 'yajl/gzip'
5
9
  require 'yajl/deflate'
6
10
  require 'yajl/http_stream'
@@ -53,14 +57,16 @@ describe "Yajl HTTP GET request" do
53
57
  @template_hash_symbolized.should == Yajl::HttpStream.get(@uri, :symbolize_keys => true)
54
58
  end
55
59
 
56
- it "should parse a bzip2 compressed response" do
57
- prepare_mock_request_dump :bzip2
58
- @template_hash.should == Yajl::HttpStream.get(@uri)
59
- end
60
+ if defined?(Yajl::Bzip2::StreamReader)
61
+ it "should parse a bzip2 compressed response" do
62
+ prepare_mock_request_dump :bzip2
63
+ @template_hash.should == Yajl::HttpStream.get(@uri)
64
+ end
60
65
 
61
- it "should parse a bzip2 compressed response and symbolize keys" do
62
- prepare_mock_request_dump :bzip2
63
- @template_hash_symbolized.should == Yajl::HttpStream.get(@uri, :symbolize_keys => true)
66
+ it "should parse a bzip2 compressed response and symbolize keys" do
67
+ prepare_mock_request_dump :bzip2
68
+ @template_hash_symbolized.should == Yajl::HttpStream.get(@uri, :symbolize_keys => true)
69
+ end
64
70
  end
65
71
 
66
72
  it "should parse a deflate compressed response" do
@@ -1,6 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
3
- require 'yajl/bzip2'
3
+ begin
4
+ require 'yajl/bzip2'
5
+ rescue
6
+ warn "Couldn't load yajl/bzip2, maybe you don't have bzip2-ruby installed? Continuing without running bzip2 specs."
7
+ end
4
8
  require 'yajl/gzip'
5
9
  require 'yajl/deflate'
6
10
  require 'yajl/http_stream'
@@ -54,14 +58,16 @@ describe "Yajl HTTP POST request" do
54
58
  @template_hash_symbolized.should == Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true)
55
59
  end
56
60
 
57
- it "should parse a bzip2 compressed response" do
58
- prepare_mock_request_dump :bzip2
59
- @template_hash.should == Yajl::HttpStream.post(@uri, @body)
60
- end
61
+ if defined?(Yajl::Bzip2::StreamReader)
62
+ it "should parse a bzip2 compressed response" do
63
+ prepare_mock_request_dump :bzip2
64
+ @template_hash.should == Yajl::HttpStream.post(@uri, @body)
65
+ end
61
66
 
62
- it "should parse a bzip2 compressed response and symbolize keys" do
63
- prepare_mock_request_dump :bzip2
64
- @template_hash_symbolized.should == Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true)
67
+ it "should parse a bzip2 compressed response and symbolize keys" do
68
+ prepare_mock_request_dump :bzip2
69
+ @template_hash_symbolized.should == Yajl::HttpStream.post(@uri, @body, :symbolize_keys => true)
70
+ end
65
71
  end
66
72
 
67
73
  it "should parse a deflate compressed response" do
@@ -1,6 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
3
- require 'yajl/bzip2'
3
+ begin
4
+ require 'yajl/bzip2'
5
+ rescue
6
+ warn "Couldn't load yajl/bzip2, maybe you don't have bzip2-ruby installed? Continuing without running bzip2 specs."
7
+ end
4
8
  require 'yajl/gzip'
5
9
  require 'yajl/deflate'
6
10
  require 'yajl/http_stream'
@@ -54,14 +58,16 @@ describe "Yajl HTTP PUT request" do
54
58
  @template_hash_symbolized.should == Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true)
55
59
  end
56
60
 
57
- it "should parse a bzip2 compressed response" do
58
- prepare_mock_request_dump :bzip2
59
- @template_hash.should == Yajl::HttpStream.put(@uri, @body)
60
- end
61
+ if defined?(Yajl::Bzip2::StreamReader)
62
+ it "should parse a bzip2 compressed response" do
63
+ prepare_mock_request_dump :bzip2
64
+ @template_hash.should == Yajl::HttpStream.put(@uri, @body)
65
+ end
61
66
 
62
- it "should parse a bzip2 compressed response and symbolize keys" do
63
- prepare_mock_request_dump :bzip2
64
- @template_hash_symbolized.should == Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true)
67
+ it "should parse a bzip2 compressed response and symbolize keys" do
68
+ prepare_mock_request_dump :bzip2
69
+ @template_hash_symbolized.should == Yajl::HttpStream.put(@uri, @body, :symbolize_keys => true)
70
+ end
65
71
  end
66
72
 
67
73
  it "should parse a deflate compressed response" do
@@ -65,6 +65,20 @@ describe "JSON Gem compatability API" do
65
65
  dt.to_json.should == "\"#{dt.to_s}\""
66
66
  end
67
67
 
68
+ it "should have the standard parsing and encoding exceptions mapped" do
69
+ JSON::JSONError.new.is_a?(StandardError).should be_true
70
+ JSON::ParserError.new.is_a?(JSON::JSONError).should be_true
71
+ JSON::GeneratorError.new.is_a?(JSON::JSONError).should be_true
72
+
73
+ lambda {
74
+ JSON.parse("blah")
75
+ }.should raise_error(JSON::ParserError)
76
+
77
+ lambda {
78
+ JSON.generate(0.0/0.0)
79
+ }.should raise_error(JSON::GeneratorError)
80
+ end
81
+
68
82
  context "ported tests for Unicode" do
69
83
  it "should be able to encode and parse unicode" do
70
84
  pending if RUBY_VERSION.include?('1.9') # FIXME: Some string encoding problem with 1.9
@@ -159,7 +173,7 @@ describe "JSON Gem compatability API" do
159
173
  it "should not be able to parse #{File.basename(name)} as an IO" do
160
174
  lambda {
161
175
  JSON.parse(StringIO.new(source))
162
- }.should raise_error(Yajl::ParseError)
176
+ }.should raise_error(JSON::ParserError)
163
177
  end
164
178
  end
165
179
 
@@ -167,7 +181,7 @@ describe "JSON Gem compatability API" do
167
181
  it "should not be able to parse #{File.basename(name)} as a string" do
168
182
  lambda {
169
183
  JSON.parse(source)
170
- }.should raise_error(Yajl::ParseError)
184
+ }.should raise_error(JSON::ParserError)
171
185
  end
172
186
  end
173
187
 
@@ -175,7 +189,7 @@ describe "JSON Gem compatability API" do
175
189
  it "should be able to parse #{File.basename(name)} as an IO" do
176
190
  lambda {
177
191
  JSON.parse(StringIO.new(source))
178
- }.should_not raise_error(Yajl::ParseError)
192
+ }.should_not raise_error(JSON::ParserError)
179
193
  end
180
194
  end
181
195
 
@@ -183,7 +197,7 @@ describe "JSON Gem compatability API" do
183
197
  it "should be able to parse #{File.basename(name)} as a string" do
184
198
  lambda {
185
199
  JSON.parse(source)
186
- }.should_not raise_error(Yajl::ParseError)
200
+ }.should_not raise_error(JSON::ParserError)
187
201
  end
188
202
  end
189
203
  end
@@ -24,11 +24,15 @@ describe "One-off JSON examples" do
24
24
  end
25
25
 
26
26
  it "should not parse invalid UTF8 with :check_utf8 set to true" do
27
- pending "not sure how to write this test yet"
27
+ parser = Yajl::Parser.new(:check_utf8 => true)
28
+ lambda {
29
+ parser.parse("[\"#{"\201\203"}\"]")
30
+ }.should raise_error(Yajl::ParseError)
28
31
  end
29
32
 
30
33
  it "should parse invalid UTF8 with :check_utf8 set to false" do
31
- pending "not sure how to write this test yet"
34
+ parser = Yajl::Parser.new(:check_utf8 => false)
35
+ puts parser.parse("[\"#{"\201\203"}\"]").inspect
32
36
  end
33
37
 
34
38
  it "should parse using it's class method, from an IO" do
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yajl-ruby}
8
- s.version = "0.6.3"
8
+ s.version = "0.6.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Lopez", "Lloyd Hilaiel"]
12
- s.date = %q{2009-08-25}
12
+ s.date = %q{2009-11-04}
13
13
  s.email = %q{seniorlopez@gmail.com}
14
14
  s.extensions = ["ext/extconf.rb"]
15
15
  s.extra_rdoc_files = [
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
79
79
  "lib/yajl/json_gem/encoding.rb",
80
80
  "lib/yajl/json_gem/parsing.rb",
81
81
  "spec/encoding/encoding_spec.rb",
82
+ "spec/global/global_spec.rb",
82
83
  "spec/http/fixtures/http.bzip2.dump",
83
84
  "spec/http/fixtures/http.deflate.dump",
84
85
  "spec/http/fixtures/http.gzip.dump",
@@ -162,6 +163,7 @@ Gem::Specification.new do |s|
162
163
  s.summary = %q{Ruby C bindings to the excellent Yajl JSON stream-based parser library.}
163
164
  s.test_files = [
164
165
  "spec/encoding/encoding_spec.rb",
166
+ "spec/global/global_spec.rb",
165
167
  "spec/http/http_delete_spec.rb",
166
168
  "spec/http/http_get_spec.rb",
167
169
  "spec/http/http_post_spec.rb",
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: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-08-25 00:00:00 -07:00
13
+ date: 2009-11-04 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -86,6 +86,7 @@ files:
86
86
  - lib/yajl/json_gem/encoding.rb
87
87
  - lib/yajl/json_gem/parsing.rb
88
88
  - spec/encoding/encoding_spec.rb
89
+ - spec/global/global_spec.rb
89
90
  - spec/http/fixtures/http.bzip2.dump
90
91
  - spec/http/fixtures/http.deflate.dump
91
92
  - spec/http/fixtures/http.gzip.dump
@@ -191,6 +192,7 @@ specification_version: 3
191
192
  summary: Ruby C bindings to the excellent Yajl JSON stream-based parser library.
192
193
  test_files:
193
194
  - spec/encoding/encoding_spec.rb
195
+ - spec/global/global_spec.rb
194
196
  - spec/http/http_delete_spec.rb
195
197
  - spec/http/http_get_spec.rb
196
198
  - spec/http/http_post_spec.rb