bson 2.2.3-java → 2.2.4-java

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bson-ruby.jar +0 -0
  3. data/lib/bson.rb +2 -1
  4. data/lib/bson/array.rb +1 -1
  5. data/lib/bson/binary.rb +1 -1
  6. data/lib/bson/boolean.rb +1 -1
  7. data/lib/bson/code.rb +1 -1
  8. data/lib/bson/code_with_scope.rb +1 -1
  9. data/lib/bson/date.rb +1 -1
  10. data/lib/bson/date_time.rb +1 -1
  11. data/lib/bson/document.rb +1 -1
  12. data/lib/bson/encodable.rb +1 -1
  13. data/lib/bson/environment.rb +1 -1
  14. data/lib/bson/false_class.rb +1 -1
  15. data/lib/bson/float.rb +1 -1
  16. data/lib/bson/hash.rb +1 -1
  17. data/lib/bson/int32.rb +1 -1
  18. data/lib/bson/int64.rb +1 -1
  19. data/lib/bson/integer.rb +1 -1
  20. data/lib/bson/json.rb +1 -1
  21. data/lib/bson/max_key.rb +1 -1
  22. data/lib/bson/min_key.rb +1 -1
  23. data/lib/bson/nil_class.rb +1 -1
  24. data/lib/bson/object.rb +61 -0
  25. data/lib/bson/object_id.rb +1 -1
  26. data/lib/bson/regexp.rb +1 -1
  27. data/lib/bson/registry.rb +1 -1
  28. data/lib/bson/specialized.rb +1 -1
  29. data/lib/bson/string.rb +1 -1
  30. data/lib/bson/symbol.rb +1 -1
  31. data/lib/bson/time.rb +1 -1
  32. data/lib/bson/timestamp.rb +1 -1
  33. data/lib/bson/true_class.rb +1 -1
  34. data/lib/bson/undefined.rb +1 -1
  35. data/lib/bson/version.rb +2 -2
  36. data/spec/bson/array_spec.rb +1 -1
  37. data/spec/bson/binary_spec.rb +1 -1
  38. data/spec/bson/boolean_spec.rb +1 -1
  39. data/spec/bson/code_spec.rb +1 -1
  40. data/spec/bson/code_with_scope_spec.rb +1 -1
  41. data/spec/bson/date_spec.rb +1 -1
  42. data/spec/bson/date_time_spec.rb +1 -1
  43. data/spec/bson/document_spec.rb +1 -1
  44. data/spec/bson/false_class_spec.rb +1 -1
  45. data/spec/bson/float_spec.rb +1 -1
  46. data/spec/bson/hash_spec.rb +1 -1
  47. data/spec/bson/int32_spec.rb +1 -1
  48. data/spec/bson/int64_spec.rb +1 -1
  49. data/spec/bson/integer_spec.rb +1 -1
  50. data/spec/bson/json_spec.rb +1 -1
  51. data/spec/bson/max_key_spec.rb +1 -1
  52. data/spec/bson/min_key_spec.rb +1 -1
  53. data/spec/bson/nil_class_spec.rb +1 -1
  54. data/spec/bson/object_id_spec.rb +18 -1
  55. data/spec/bson/object_spec.rb +31 -0
  56. data/spec/bson/regexp_spec.rb +1 -1
  57. data/spec/bson/registry_spec.rb +1 -1
  58. data/spec/bson/string_spec.rb +1 -1
  59. data/spec/bson/symbol_spec.rb +1 -1
  60. data/spec/bson/time_spec.rb +1 -1
  61. data/spec/bson/timestamp_spec.rb +1 -1
  62. data/spec/bson/true_class_spec.rb +1 -1
  63. data/spec/bson/undefined_spec.rb +1 -1
  64. data/spec/bson_spec.rb +1 -1
  65. data/spec/spec_helper.rb +1 -1
  66. data/spec/support/shared_examples.rb +1 -1
  67. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d692eea99d6fafcee6f4f8e8d0f917e23ca72e29
4
- data.tar.gz: c74e0fc0429d307995f1d459a19edc60b558b133
3
+ metadata.gz: 5a7dd76416c2ce339619e60856e3948622ab724e
4
+ data.tar.gz: 302faf27ea7bd5292880751709ddb010b92cefff
5
5
  SHA512:
6
- metadata.gz: 667d6954f96c4c6492018fbdf9dc5bfbef2c0b4a1eb6749a159a57c82180b5cb4dfcb45722930701f5a06a7323571f076825ee884ff17f1c975cca314ca29fbf
7
- data.tar.gz: f3f3df254bccec5380f76260656c9f1b7d5b26a5c5a3f40298e28a092b029ddd7da28a79f1be37cf47d8bb2ce52a855388c81939977d5e52d0c279f6111640b8
6
+ metadata.gz: 99a3260fef8ea1b28f35e4c61de1d668ec74074fe50dc943d26aa35c6061f31e2f1f38f544c12081bb6350e844844f65831df6acc2b7c6703365b73da373b5cb
7
+ data.tar.gz: 3bb12b493125b6adda513b551ebe9ef3831ff36ec06d5e60a4051c6e1f87bb69b146cf95f9930487dfcba5a2d50573d6c53671354b32cd9c5cda8af5ea111746
Binary file
@@ -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: java
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:
@@ -49,6 +49,7 @@ files:
49
49
  - lib/bson/max_key.rb
50
50
  - lib/bson/min_key.rb
51
51
  - lib/bson/nil_class.rb
52
+ - lib/bson/object.rb
52
53
  - lib/bson/object_id.rb
53
54
  - lib/bson/regexp.rb
54
55
  - lib/bson/registry.rb
@@ -79,6 +80,7 @@ files:
79
80
  - spec/bson/min_key_spec.rb
80
81
  - spec/bson/nil_class_spec.rb
81
82
  - spec/bson/object_id_spec.rb
83
+ - spec/bson/object_spec.rb
82
84
  - spec/bson/regexp_spec.rb
83
85
  - spec/bson/registry_spec.rb
84
86
  - spec/bson/string_spec.rb
@@ -102,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
104
  requirements:
103
105
  - - '>='
104
106
  - !ruby/object:Gem::Version
105
- version: 1.8.7
107
+ version: 1.9.3
106
108
  required_rubygems_version: !ruby/object:Gem::Requirement
107
109
  requirements:
108
110
  - - '>='
@@ -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