bson 2.2.3 → 2.2.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.

Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bson.rb +2 -1
  3. data/lib/bson/array.rb +1 -1
  4. data/lib/bson/binary.rb +1 -1
  5. data/lib/bson/boolean.rb +1 -1
  6. data/lib/bson/code.rb +1 -1
  7. data/lib/bson/code_with_scope.rb +1 -1
  8. data/lib/bson/date.rb +1 -1
  9. data/lib/bson/date_time.rb +1 -1
  10. data/lib/bson/document.rb +1 -1
  11. data/lib/bson/encodable.rb +1 -1
  12. data/lib/bson/environment.rb +1 -1
  13. data/lib/bson/false_class.rb +1 -1
  14. data/lib/bson/float.rb +1 -1
  15. data/lib/bson/hash.rb +1 -1
  16. data/lib/bson/int32.rb +1 -1
  17. data/lib/bson/int64.rb +1 -1
  18. data/lib/bson/integer.rb +1 -1
  19. data/lib/bson/json.rb +1 -1
  20. data/lib/bson/max_key.rb +1 -1
  21. data/lib/bson/min_key.rb +1 -1
  22. data/lib/bson/nil_class.rb +1 -1
  23. data/lib/bson/object.rb +61 -0
  24. data/lib/bson/object_id.rb +1 -1
  25. data/lib/bson/regexp.rb +1 -1
  26. data/lib/bson/registry.rb +1 -1
  27. data/lib/bson/specialized.rb +1 -1
  28. data/lib/bson/string.rb +1 -1
  29. data/lib/bson/symbol.rb +1 -1
  30. data/lib/bson/time.rb +1 -1
  31. data/lib/bson/timestamp.rb +1 -1
  32. data/lib/bson/true_class.rb +1 -1
  33. data/lib/bson/undefined.rb +1 -1
  34. data/lib/bson/version.rb +2 -2
  35. data/spec/bson/array_spec.rb +1 -1
  36. data/spec/bson/binary_spec.rb +1 -1
  37. data/spec/bson/boolean_spec.rb +1 -1
  38. data/spec/bson/code_spec.rb +1 -1
  39. data/spec/bson/code_with_scope_spec.rb +1 -1
  40. data/spec/bson/date_spec.rb +1 -1
  41. data/spec/bson/date_time_spec.rb +1 -1
  42. data/spec/bson/document_spec.rb +1 -1
  43. data/spec/bson/false_class_spec.rb +1 -1
  44. data/spec/bson/float_spec.rb +1 -1
  45. data/spec/bson/hash_spec.rb +1 -1
  46. data/spec/bson/int32_spec.rb +1 -1
  47. data/spec/bson/int64_spec.rb +1 -1
  48. data/spec/bson/integer_spec.rb +1 -1
  49. data/spec/bson/json_spec.rb +1 -1
  50. data/spec/bson/max_key_spec.rb +1 -1
  51. data/spec/bson/min_key_spec.rb +1 -1
  52. data/spec/bson/nil_class_spec.rb +1 -1
  53. data/spec/bson/object_id_spec.rb +18 -1
  54. data/spec/bson/object_spec.rb +31 -0
  55. data/spec/bson/regexp_spec.rb +1 -1
  56. data/spec/bson/registry_spec.rb +1 -1
  57. data/spec/bson/string_spec.rb +1 -1
  58. data/spec/bson/symbol_spec.rb +1 -1
  59. data/spec/bson/time_spec.rb +1 -1
  60. data/spec/bson/timestamp_spec.rb +1 -1
  61. data/spec/bson/true_class_spec.rb +1 -1
  62. data/spec/bson/undefined_spec.rb +1 -1
  63. data/spec/bson_spec.rb +1 -1
  64. data/spec/spec_helper.rb +1 -1
  65. data/spec/support/shared_examples.rb +1 -1
  66. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9243f0f1528aa27def97c45d8da35f22ca6ebb7d
4
- data.tar.gz: 70beb8ef6d44d9206ac83d17753e3fc835dbada9
3
+ metadata.gz: 33f503f9418e54b133f0115a51c642a1413de120
4
+ data.tar.gz: e2ad2a8903b3a672328ebaad368e6d6e24b33579
5
5
  SHA512:
6
- metadata.gz: 57bc18e43c59df8d231f9ff3bef01c5f366d783e1995a1e5f3b8d3d9f346a28cc2bc8f997f42fc786df318f0b8f0b918c9f4a88e99aa80e2fec1cf2b7c6db3be
7
- data.tar.gz: 95d717c28bbab4bed59a16c4ee53d7990439adbd0479ca5ca27b4f3952ea1ade2ec493571eafd494de6b58d42b3fe4f051c81d2ee277bf552203ce95e9de367c
6
+ metadata.gz: 5cb2f4d67d4eed6883435e9c0411f3fb9f8169fd90db9606b61b48e69ade2d6ecda1ec6e15bcd87ec7dee7c071a34a2dff610dee4547f52adbe5ac040691366a
7
+ data.tar.gz: c8b362f0718d233c8a3cacc32c52034b8eac59c74c08b0847994f263a653715af424b1621e8e973c33325152f78265a45b66f3fd09f4354240f1e673ff6f1e29
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -61,6 +61,7 @@ require "bson/hash"
61
61
  require "bson/max_key"
62
62
  require "bson/min_key"
63
63
  require "bson/nil_class"
64
+ require "bson/object"
64
65
  require "bson/object_id"
65
66
  require "bson/regexp"
66
67
  require "bson/string"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -0,0 +1,61 @@
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module BSON
16
+
17
+ # Injects behaviour for all Ruby objects.
18
+ #
19
+ # @since 2.2.4
20
+ module Object
21
+
22
+ # Objects that don't override this method will raise an error when trying
23
+ # to use them as keys in a BSON document. This is only overridden in String
24
+ # and Symbol.
25
+ #
26
+ # @example Convert the object to a BSON key.
27
+ # object.to_bson_key
28
+ #
29
+ # @raise [ InvalidKey ] Always raises an exception.
30
+ #
31
+ # @see http://bsonspec.org/#/specification
32
+ #
33
+ # @since 2.2.4
34
+ def to_bson_key(encoded = ''.force_encoding(BINARY))
35
+ raise InvalidKey.new(self)
36
+ end
37
+ end
38
+
39
+ # Raised when trying to serialize an object into a key.
40
+ #
41
+ # @since 2.2.4
42
+ class InvalidKey < RuntimeError
43
+
44
+ # Instantiate the exception.
45
+ #
46
+ # @example Instantiate the exception.
47
+ # BSON::Object::InvalidKey.new(object)
48
+ #
49
+ # @param [ Object ] object The object that was meant for the key.
50
+ #
51
+ # @since 2.2.4
52
+ def initialize(object)
53
+ super("#{object.class} instances are not allowed as keys in a BSON document.")
54
+ end
55
+ end
56
+
57
+ # Enrich the core Object class with this module.
58
+ #
59
+ # @since 2.2.4
60
+ ::Object.send(:include, Object)
61
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright (C) 2009-2013 MongoDB Inc.
2
+ # Copyright (C) 2009-2014 MongoDB Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module BSON
16
- VERSION = "2.2.3"
16
+ VERSION = "2.2.4"
17
17
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2009-2013 MongoDB Inc.
3
+ # Copyright (C) 2009-2014 MongoDB Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -521,4 +521,21 @@ describe BSON::ObjectId do
521
521
  expect(registered).to eq(described_class)
522
522
  end
523
523
  end
524
+
525
+ context "when the ids are used as keys" do
526
+
527
+ let(:object_id) do
528
+ described_class.new
529
+ end
530
+
531
+ let(:hash) do
532
+ { object_id => 1 }
533
+ end
534
+
535
+ it "raises an exception on serialization" do
536
+ expect {
537
+ hash.to_bson
538
+ }.to raise_error(BSON::InvalidKey)
539
+ end
540
+ end
524
541
  end
@@ -0,0 +1,31 @@
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "spec_helper"
16
+
17
+ describe BSON::Object do
18
+
19
+ describe "#to_bson_key" do
20
+
21
+ let(:object) do
22
+ 1..3
23
+ end
24
+
25
+ it "raises an exception" do
26
+ expect {
27
+ object.to_bson_key
28
+ }.to raise_error(BSON::InvalidKey)
29
+ end
30
+ end
31
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Copyright (C) 2009-2013 MongoDB Inc.
3
+ # Copyright (C) 2009-2014 MongoDB Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2013 MongoDB Inc.
1
+ # Copyright (C) 2009-2014 MongoDB Inc.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
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: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-05-05 00:00:00.000000000 Z
15
+ date: 2014-05-20 00:00:00.000000000 Z
16
16
  dependencies: []
17
17
  description: A full featured BSON specification implementation, in Ruby
18
18
  email:
@@ -51,6 +51,7 @@ files:
51
51
  - lib/bson/max_key.rb
52
52
  - lib/bson/min_key.rb
53
53
  - lib/bson/nil_class.rb
54
+ - lib/bson/object.rb
54
55
  - lib/bson/object_id.rb
55
56
  - lib/bson/regexp.rb
56
57
  - lib/bson/registry.rb
@@ -81,6 +82,7 @@ files:
81
82
  - spec/bson/min_key_spec.rb
82
83
  - spec/bson/nil_class_spec.rb
83
84
  - spec/bson/object_id_spec.rb
85
+ - spec/bson/object_spec.rb
84
86
  - spec/bson/regexp_spec.rb
85
87
  - spec/bson/registry_spec.rb
86
88
  - spec/bson/string_spec.rb
@@ -104,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
106
  requirements:
105
107
  - - ">="
106
108
  - !ruby/object:Gem::Version
107
- version: 1.8.7
109
+ version: 1.9.3
108
110
  required_rubygems_version: !ruby/object:Gem::Requirement
109
111
  requirements:
110
112
  - - ">="
@@ -136,6 +138,7 @@ test_files:
136
138
  - spec/bson/min_key_spec.rb
137
139
  - spec/bson/nil_class_spec.rb
138
140
  - spec/bson/object_id_spec.rb
141
+ - spec/bson/object_spec.rb
139
142
  - spec/bson/regexp_spec.rb
140
143
  - spec/bson/registry_spec.rb
141
144
  - spec/bson/string_spec.rb