bson 1.0.5 → 1.0.6

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.

@@ -2,10 +2,10 @@
2
2
 
3
3
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
- MINIMUM_BSON_EXT_VERSION = "1.0.5"
5
+ MINIMUM_BSON_EXT_VERSION = "1.0.6"
6
6
 
7
7
  module BSON
8
- VERSION = "1.0.5"
8
+ VERSION = "1.0.6"
9
9
  def self.serialize(obj, check_keys=false, move_id=false)
10
10
  BSON_CODER.serialize(obj, check_keys, move_id)
11
11
  end
@@ -88,7 +88,7 @@ module BSON
88
88
  @ordered_keys ||= []
89
89
  @ordered_keys.map { |k| [k, self[k]] }
90
90
  end
91
-
91
+
92
92
  def values
93
93
  collect { |k, v| v }
94
94
  end
@@ -158,6 +158,9 @@ module BSON
158
158
  end
159
159
  end
160
160
 
161
+ def clone
162
+ Marshal::load(Marshal.dump(self))
163
+ end
161
164
  end
162
165
  end
163
166
  end
@@ -6,11 +6,10 @@ require 'rational'
6
6
 
7
7
  begin
8
8
  require 'active_support/core_ext'
9
- require 'active_support/hash_with_indifferent_access'
10
9
  Time.zone = "Pacific Time (US & Canada)"
11
10
  Zone = Time.zone.now
12
11
  rescue LoadError
13
- warn 'Could not test BSON with HashWithIndifferentAccess.'
12
+ warn 'Mocking time with zone'
14
13
  module ActiveSupport
15
14
  class TimeWithZone
16
15
  end
@@ -523,20 +522,22 @@ class BSONTest < Test::Unit::TestCase
523
522
  BSON::BSON_CODER.serialize(c, false, false).to_s
524
523
  end
525
524
 
526
- if defined?(HashWithIndifferentAccess)
527
- def test_keep_id_with_hash_with_indifferent_access
528
- doc = HashWithIndifferentAccess.new
529
- embedded = HashWithIndifferentAccess.new
530
- embedded['_id'] = ObjectID.new
531
- doc['_id'] = ObjectID.new
532
- doc['embedded'] = [embedded]
533
- BSON::BSON_CODER.serialize(doc, false, true).to_a
534
- assert doc.has_key?("_id")
535
- assert doc['embedded'][0].has_key?("_id")
536
-
537
- doc['_id'] = ObjectID.new
538
- BSON::BSON_CODER.serialize(doc, false, true).to_a
539
- assert doc.has_key?("_id")
540
- end
525
+ # Mocking this class for testing
526
+ class ::HashWithIndifferentAccess < Hash; end
527
+
528
+ def test_keep_id_with_hash_with_indifferent_access
529
+ doc = HashWithIndifferentAccess.new
530
+ embedded = HashWithIndifferentAccess.new
531
+ embedded['_id'] = ObjectID.new
532
+ doc['_id'] = ObjectID.new
533
+ doc['embedded'] = [embedded]
534
+ BSON::BSON_CODER.serialize(doc, false, true).to_a
535
+ assert doc.has_key?("_id")
536
+ assert doc['embedded'][0].has_key?("_id")
537
+
538
+ doc['_id'] = ObjectID.new
539
+ BSON::BSON_CODER.serialize(doc, false, true).to_a
540
+ assert doc.has_key?("_id")
541
541
  end
542
+
542
543
  end
@@ -187,4 +187,11 @@ class OrderedHashTest < Test::Unit::TestCase
187
187
  assert !new.keys.include?('z')
188
188
  end
189
189
 
190
+ def test_clone
191
+ copy = @oh.clone
192
+ assert copy.keys == @oh.keys
193
+
194
+ copy[:foo] = 1
195
+ assert copy.keys != @oh.keys
196
+ end
190
197
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 5
10
- version: 1.0.5
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Menard
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-08-27 00:00:00 -04:00
20
+ date: 2010-08-28 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies: []
23
23