bson 1.6.2 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bson might be problematic. Click here for more details.

data/bin/b2json CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
 
4
4
  # --
data/bin/j2bson CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
 
4
4
  # --
@@ -62,7 +62,7 @@ module BSON
62
62
  rescue
63
63
  raise InvalidStringEncoding, "String not valid utf-8: #{str.inspect}"
64
64
  end
65
- str.encode(UTF8_ENCODING).force_encoding(BINARY_ENCODING)
65
+ str.dup.force_encoding(BINARY_ENCODING)
66
66
  end
67
67
  else
68
68
  NULL_BYTE = "\0"
@@ -1,3 +1,3 @@
1
1
  module BSON
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.4"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  # encoding:utf-8
2
- require './test/bson/test_helper'
2
+ require File.expand_path("../test_helper", __FILE__)
3
3
 
4
4
  class BinaryTest < Test::Unit::TestCase
5
5
  def setup
@@ -1,5 +1,5 @@
1
1
  # encoding:utf-8
2
- require './test/bson/test_helper'
2
+ require File.expand_path("../test_helper", __FILE__)
3
3
  require 'set'
4
4
 
5
5
  if RUBY_VERSION < '1.9'
@@ -141,6 +141,13 @@ class BSONTest < Test::Unit::TestCase
141
141
  end
142
142
  end
143
143
 
144
+ def test_forced_encoding_with_valid_utf8
145
+ doc = {'doc' => "\xC3\xB6".force_encoding("ISO-8859-1")}
146
+ serialized = @encoder.serialize(doc)
147
+ deserialized = @encoder.deserialize(serialized)
148
+ assert_equal(doc['doc'], deserialized['doc'].force_encoding("ISO-8859-1"))
149
+ end
150
+
144
151
  # Based on a test from sqlite3-ruby
145
152
  def test_default_internal_is_honored
146
153
  before_enc = Encoding.default_internal
@@ -1,5 +1,5 @@
1
1
  # encoding: binary
2
- require './test/bson/test_helper'
2
+ require File.expand_path("../test_helper", __FILE__)
3
3
 
4
4
  class ByteBufferTest < Test::Unit::TestCase
5
5
  include BSON
@@ -1,5 +1,5 @@
1
1
  # encoding:utf-8
2
- require './test/bson/test_helper'
2
+ require File.expand_path("../test_helper", __FILE__)
3
3
  require './test/support/hash_with_indifferent_access'
4
4
 
5
5
  class HashWithIndifferentAccessTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require './test/bson/test_helper'
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
  require 'rubygems'
3
3
  require 'json'
4
4
 
@@ -1,4 +1,4 @@
1
- require './test/bson/test_helper'
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
  require 'rubygems'
3
3
  require 'json'
4
4
 
@@ -135,4 +135,14 @@ class ObjectIdTest < Test::Unit::TestCase
135
135
  id = ObjectId.new
136
136
  assert_equal({"$oid" => id.to_s}, id.as_json)
137
137
  end
138
+
139
+ def test_object_id_array_flatten
140
+ id = ObjectId.new
141
+ assert_equal [ id ], [[ id ]].flatten
142
+ end
143
+
144
+ def test_object_id_array_flatten_bang
145
+ id = ObjectId.new
146
+ assert_equal [ id ], [[ id ]].flatten!
147
+ end
138
148
  end
@@ -1,4 +1,4 @@
1
- require './test/bson/test_helper'
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
 
3
3
  class OrderedHashTest < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require './test/bson/test_helper'
1
+ require File.expand_path("../test_helper", __FILE__)
2
2
 
3
3
  class TimestampTest < Test::Unit::TestCase
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-04-05 00:00:00.000000000 Z
14
+ date: 2012-06-06 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: A Ruby BSON implementation for MongoDB. For more information about Mongo,
17
17
  see http://www.mongodb.org. For more information on BSON, see http://www.bsonspec.org.
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  version: '0'
70
70
  requirements: []
71
71
  rubyforge_project:
72
- rubygems_version: 1.8.21
72
+ rubygems_version: 1.8.24
73
73
  signing_key:
74
74
  specification_version: 3
75
75
  summary: Ruby implementation of BSON