mongo 0.19 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongo.rb +1 -1
- data/test/bson_test.rb +19 -14
- metadata +2 -2
data/lib/mongo.rb
CHANGED
data/test/bson_test.rb
CHANGED
@@ -4,11 +4,18 @@ require 'complex'
|
|
4
4
|
require 'bigdecimal'
|
5
5
|
require 'rational'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
begin
|
8
|
+
require 'active_support/core_ext'
|
9
|
+
require 'active_support/hash_with_indifferent_access'
|
10
|
+
Time.zone = "Pacific Time (US & Canada)"
|
11
|
+
Zone = Time.zone.now
|
12
|
+
rescue LoadError
|
13
|
+
warn 'Could not test BSON with HashWithIndifferentAccess.'
|
14
|
+
module ActiveSupport
|
15
|
+
class TimeWithZone
|
16
|
+
end
|
11
17
|
end
|
18
|
+
Zone = ActiveSupport::TimeWithZone.new
|
12
19
|
end
|
13
20
|
|
14
21
|
class BSONTest < Test::Unit::TestCase
|
@@ -191,7 +198,7 @@ class BSONTest < Test::Unit::TestCase
|
|
191
198
|
end
|
192
199
|
|
193
200
|
def test_exeption_on_using_unsupported_date_class
|
194
|
-
[DateTime.now, Date.today,
|
201
|
+
[DateTime.now, Date.today, Zone].each do |invalid_date|
|
195
202
|
doc = {:date => invalid_date}
|
196
203
|
begin
|
197
204
|
bson = BSON.serialize(doc)
|
@@ -433,21 +440,19 @@ class BSONTest < Test::Unit::TestCase
|
|
433
440
|
BSON.serialize(c, false, false).to_s
|
434
441
|
end
|
435
442
|
|
436
|
-
begin
|
437
|
-
require 'active_support'
|
438
|
-
rescue LoadError
|
439
|
-
warn 'Could not test BSON with HashWithIndifferentAccess.'
|
440
|
-
end
|
441
|
-
|
442
443
|
if defined?(HashWithIndifferentAccess)
|
443
444
|
def test_keep_id_with_hash_with_indifferent_access
|
444
445
|
doc = HashWithIndifferentAccess.new
|
445
|
-
|
446
|
-
|
446
|
+
embedded = HashWithIndifferentAccess.new
|
447
|
+
embedded['_id'] = ObjectID.new
|
448
|
+
doc['_id'] = ObjectID.new
|
449
|
+
doc['embedded'] = [embedded]
|
450
|
+
BSON.serialize(doc, false, true).to_a
|
447
451
|
assert doc.has_key?("_id")
|
452
|
+
assert doc['embedded'][0].has_key?("_id")
|
448
453
|
|
449
454
|
doc['_id'] = ObjectID.new
|
450
|
-
BSON.serialize(doc, false,
|
455
|
+
BSON.serialize(doc, false, true).to_a
|
451
456
|
assert doc.has_key?("_id")
|
452
457
|
end
|
453
458
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Menard
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-03-
|
14
|
+
date: 2010-03-02 00:00:00 -05:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|