bson 1.2.0 → 1.2.1
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.
- data/lib/bson.rb +2 -2
- data/test/bson/bson_test.rb +43 -0
- metadata +5 -8
data/lib/bson.rb
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
20
20
|
|
|
21
|
-
MINIMUM_BSON_EXT_VERSION = "1.2.
|
|
21
|
+
MINIMUM_BSON_EXT_VERSION = "1.2.1"
|
|
22
22
|
|
|
23
23
|
module BSON
|
|
24
|
-
VERSION = "1.2.
|
|
24
|
+
VERSION = "1.2.1"
|
|
25
25
|
|
|
26
26
|
if defined? Mongo::DEFAULT_MAX_BSON_SIZE
|
|
27
27
|
DEFAULT_MAX_BSON_SIZE = Mongo::DEFAULT_MAX_BSON_SIZE
|
data/test/bson/bson_test.rb
CHANGED
|
@@ -562,4 +562,47 @@ class BSONTest < Test::Unit::TestCase
|
|
|
562
562
|
end
|
|
563
563
|
end
|
|
564
564
|
|
|
565
|
+
def test_invalid_key_names
|
|
566
|
+
assert @encoder.serialize({"hello" => "world"}, true)
|
|
567
|
+
assert @encoder.serialize({"hello" => {"hello" => "world"}}, true)
|
|
568
|
+
|
|
569
|
+
assert @encoder.serialize({"he$llo" => "world"}, true)
|
|
570
|
+
assert @encoder.serialize({"hello" => {"hell$o" => "world"}}, true)
|
|
571
|
+
|
|
572
|
+
assert_raise BSON::InvalidDocument do
|
|
573
|
+
@encoder.serialize({"he\0llo" => "world"}, true)
|
|
574
|
+
end
|
|
575
|
+
|
|
576
|
+
assert_raise_error BSON::InvalidKeyName, "$hello" do
|
|
577
|
+
@encoder.serialize({"$hello" => "world"}, true)
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
assert_raise BSON::InvalidKeyName do
|
|
581
|
+
@encoder.serialize({"hello" => {"$hello" => "world"}}, true)
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
assert_raise_error BSON::InvalidKeyName, ".hello" do
|
|
585
|
+
@encoder.serialize({".hello" => "world"}, true)
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
assert_raise BSON::InvalidKeyName do
|
|
589
|
+
@encoder.serialize({"hello" => {".hello" => "world"}}, true)
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
assert_raise BSON::InvalidKeyName do
|
|
593
|
+
@encoder.serialize({"hello." => "world"}, true)
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
assert_raise BSON::InvalidKeyName do
|
|
597
|
+
@encoder.serialize({"hello" => {"hello." => "world"}}, true)
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
assert_raise BSON::InvalidKeyName do
|
|
601
|
+
@encoder.serialize({"hel.lo" => "world"}, true)
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
assert_raise BSON::InvalidKeyName do
|
|
605
|
+
@encoder.serialize({"hello" => {"hel.lo" => "world"}}, true)
|
|
606
|
+
end
|
|
607
|
+
end
|
|
565
608
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bson
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease:
|
|
4
|
+
prerelease: false
|
|
6
5
|
segments:
|
|
7
6
|
- 1
|
|
8
7
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 1.2.
|
|
8
|
+
- 1
|
|
9
|
+
version: 1.2.1
|
|
11
10
|
platform: ruby
|
|
12
11
|
authors:
|
|
13
12
|
- Jim Menard
|
|
@@ -17,7 +16,7 @@ autorequire:
|
|
|
17
16
|
bindir: bin
|
|
18
17
|
cert_chain: []
|
|
19
18
|
|
|
20
|
-
date: 2011-
|
|
19
|
+
date: 2011-02-10 00:00:00 -05:00
|
|
21
20
|
default_executable:
|
|
22
21
|
dependencies: []
|
|
23
22
|
|
|
@@ -67,7 +66,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
67
66
|
requirements:
|
|
68
67
|
- - ">="
|
|
69
68
|
- !ruby/object:Gem::Version
|
|
70
|
-
hash: 3
|
|
71
69
|
segments:
|
|
72
70
|
- 0
|
|
73
71
|
version: "0"
|
|
@@ -76,14 +74,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
74
|
requirements:
|
|
77
75
|
- - ">="
|
|
78
76
|
- !ruby/object:Gem::Version
|
|
79
|
-
hash: 3
|
|
80
77
|
segments:
|
|
81
78
|
- 0
|
|
82
79
|
version: "0"
|
|
83
80
|
requirements: []
|
|
84
81
|
|
|
85
82
|
rubyforge_project:
|
|
86
|
-
rubygems_version: 1.
|
|
83
|
+
rubygems_version: 1.3.7
|
|
87
84
|
signing_key:
|
|
88
85
|
specification_version: 3
|
|
89
86
|
summary: Ruby implementation of BSON
|