bson 4.3.0 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +16 -9
  5. data/ext/bson/bson_native.c +102 -28
  6. data/lib/bson.rb +1 -1
  7. data/lib/bson/active_support.rb +17 -0
  8. data/lib/bson/array.rb +1 -1
  9. data/lib/bson/binary.rb +1 -1
  10. data/lib/bson/boolean.rb +1 -1
  11. data/lib/bson/code.rb +1 -1
  12. data/lib/bson/code_with_scope.rb +1 -1
  13. data/lib/bson/config.rb +1 -1
  14. data/lib/bson/date.rb +1 -1
  15. data/lib/bson/date_time.rb +1 -1
  16. data/lib/bson/decimal128.rb +1 -1
  17. data/lib/bson/decimal128/builder.rb +1 -1
  18. data/lib/bson/document.rb +42 -4
  19. data/lib/bson/environment.rb +1 -1
  20. data/lib/bson/false_class.rb +1 -1
  21. data/lib/bson/float.rb +1 -1
  22. data/lib/bson/hash.rb +1 -1
  23. data/lib/bson/int32.rb +17 -4
  24. data/lib/bson/int64.rb +17 -4
  25. data/lib/bson/integer.rb +2 -2
  26. data/lib/bson/json.rb +1 -1
  27. data/lib/bson/max_key.rb +1 -1
  28. data/lib/bson/min_key.rb +1 -1
  29. data/lib/bson/nil_class.rb +1 -1
  30. data/lib/bson/object.rb +1 -1
  31. data/lib/bson/object_id.rb +1 -1
  32. data/lib/bson/open_struct.rb +1 -1
  33. data/lib/bson/regexp.rb +1 -1
  34. data/lib/bson/registry.rb +1 -1
  35. data/lib/bson/specialized.rb +1 -1
  36. data/lib/bson/string.rb +1 -1
  37. data/lib/bson/symbol.rb +6 -3
  38. data/lib/bson/time.rb +1 -1
  39. data/lib/bson/time_with_zone.rb +54 -0
  40. data/lib/bson/timestamp.rb +1 -1
  41. data/lib/bson/true_class.rb +1 -1
  42. data/lib/bson/undefined.rb +1 -1
  43. data/lib/bson/version.rb +2 -2
  44. data/spec/bson/array_spec.rb +1 -1
  45. data/spec/bson/binary_spec.rb +1 -1
  46. data/spec/bson/boolean_spec.rb +1 -1
  47. data/spec/bson/byte_buffer_spec.rb +40 -0
  48. data/spec/bson/code_spec.rb +1 -1
  49. data/spec/bson/code_with_scope_spec.rb +1 -1
  50. data/spec/bson/date_spec.rb +1 -1
  51. data/spec/bson/date_time_spec.rb +1 -1
  52. data/spec/bson/decimal128_spec.rb +1 -1
  53. data/spec/bson/document_spec.rb +60 -1
  54. data/spec/bson/false_class_spec.rb +1 -1
  55. data/spec/bson/float_spec.rb +1 -1
  56. data/spec/bson/hash_spec.rb +1 -1
  57. data/spec/bson/int32_spec.rb +139 -3
  58. data/spec/bson/int64_spec.rb +139 -3
  59. data/spec/bson/integer_spec.rb +3 -3
  60. data/spec/bson/json_spec.rb +1 -1
  61. data/spec/bson/max_key_spec.rb +1 -1
  62. data/spec/bson/min_key_spec.rb +1 -1
  63. data/spec/bson/nil_class_spec.rb +1 -1
  64. data/spec/bson/object_id_spec.rb +1 -1
  65. data/spec/bson/object_spec.rb +1 -1
  66. data/spec/bson/open_struct_spec.rb +1 -1
  67. data/spec/bson/regexp_spec.rb +1 -1
  68. data/spec/bson/registry_spec.rb +1 -1
  69. data/spec/bson/string_spec.rb +1 -1
  70. data/spec/bson/symbol_spec.rb +3 -3
  71. data/spec/bson/time_spec.rb +1 -1
  72. data/spec/bson/time_with_zone_spec.rb +68 -0
  73. data/spec/bson/timestamp_spec.rb +1 -1
  74. data/spec/bson/true_class_spec.rb +1 -1
  75. data/spec/bson/undefined_spec.rb +1 -1
  76. data/spec/bson_spec.rb +1 -1
  77. data/spec/spec_helper.rb +15 -1
  78. data/spec/support/shared_examples.rb +1 -1
  79. data/spec/support/spec_config.rb +9 -0
  80. metadata +73 -68
  81. metadata.gz.sig +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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.
@@ -14,8 +14,7 @@
14
14
 
15
15
  module BSON
16
16
 
17
- # Represents a $maxKey type, which compares less than any other value in the
18
- # specification.
17
+ # Represents int32 type.
19
18
  #
20
19
  # @see http://bsonspec.org/#/specification
21
20
  #
@@ -87,9 +86,23 @@ module BSON
87
86
  #
88
87
  # @since 4.2.0
89
88
  def to_bson_key(validating_keys = Config.validating_keys?)
90
- @integer.to_bson_key(validating_keys)
89
+ @integer
91
90
  end
92
91
 
92
+ # Check equality of the int32 with another object.
93
+ #
94
+ # @param [ Object ] other The object to check against.
95
+ #
96
+ # @return [ true, false ] If the objects are equal.
97
+ #
98
+ # @since 4.4.0
99
+ def ==(other)
100
+ return false unless other.is_a?(Int32)
101
+ @integer == other.instance_variable_get('@integer')
102
+ end
103
+ alias :eql? :==
104
+ alias :=== :==
105
+
93
106
  private
94
107
 
95
108
  def out_of_range!
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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.
@@ -14,8 +14,7 @@
14
14
 
15
15
  module BSON
16
16
 
17
- # Represents a $maxKey type, which compares less than any other value in the
18
- # specification.
17
+ # Represents int64 type.
19
18
  #
20
19
  # @see http://bsonspec.org/#/specification
21
20
  #
@@ -82,9 +81,23 @@ module BSON
82
81
  #
83
82
  # @since 4.2.0
84
83
  def to_bson_key(validating_keys = Config.validating_keys?)
85
- @integer.to_bson_key(validating_keys)
84
+ @integer
86
85
  end
87
86
 
87
+ # Check equality of the int64 with another object.
88
+ #
89
+ # @param [ Object ] other The object to check against.
90
+ #
91
+ # @return [ true, false ] If the objects are equal.
92
+ #
93
+ # @since 4.4.0
94
+ def ==(other)
95
+ return false unless other.is_a?(Int64)
96
+ @integer == other.instance_variable_get('@integer')
97
+ end
98
+ alias :eql? :==
99
+ alias :=== :==
100
+
88
101
  private
89
102
 
90
103
  def out_of_range!
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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.
@@ -156,7 +156,7 @@ module BSON
156
156
  #
157
157
  # @since 2.0.0
158
158
  def to_bson_key(validating_keys = Config.validating_keys?)
159
- to_s.to_bson_key(validating_keys)
159
+ self
160
160
  end
161
161
 
162
162
  private
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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) 2016 MongoDB Inc.
1
+ # Copyright (C) 2016-2019 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-2016 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
2
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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.
@@ -57,7 +57,7 @@ module BSON
57
57
  #
58
58
  # @since 2.0.0
59
59
  def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
60
- to_s.to_bson(buffer)
60
+ buffer.put_symbol(self)
61
61
  end
62
62
 
63
63
  # Get the symbol as a BSON key name encoded C symbol.
@@ -71,7 +71,10 @@ module BSON
71
71
  #
72
72
  # @since 2.0.0
73
73
  def to_bson_key(validating_keys = Config.validating_keys?)
74
- to_s.to_bson_key(validating_keys)
74
+ if validating_keys
75
+ raise BSON::String::IllegalKey.new(self) if BSON::String::ILLEGAL_KEY =~ self
76
+ end
77
+ self
75
78
  end
76
79
 
77
80
  # Converts the symbol to a normalized key in a BSON document.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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,54 @@
1
+ # Copyright (C) 2018-2019 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 "active_support/time_with_zone"
16
+
17
+ module BSON
18
+
19
+ # Injects behaviour for encoding ActiveSupport::TimeWithZone values to
20
+ # raw bytes as specified by the BSON spec for time.
21
+ #
22
+ # @see http://bsonspec.org/#/specification
23
+ #
24
+ # @since 4.4.0
25
+ module TimeWithZone
26
+
27
+ # Get the ActiveSupport::TimeWithZone as encoded BSON.
28
+ #
29
+ # @example Get the ActiveSupport::TimeWithZone as encoded BSON.
30
+ # Time.utc(2012, 12, 12, 0, 0, 0).in_time_zone("Pacific Time (US & Canada)").to_bson
31
+ #
32
+ # @return [ BSON::ByteBuffer ] The buffer with the encoded object.
33
+ #
34
+ # @see http://bsonspec.org/#/specification
35
+ #
36
+ # @since 4.4.0
37
+ def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
38
+ buffer.put_int64((to_i * 1000) + (usec / 1000))
39
+ end
40
+
41
+ # Get the BSON type for the ActiveSupport::TimeWithZone.
42
+ #
43
+ # As the ActiveSupport::TimeWithZone is converted to a time, this returns
44
+ # the BSON type for time.
45
+ def bson_type
46
+ ::Time::BSON_TYPE
47
+ end
48
+ end
49
+
50
+ # Enrich the ActiveSupport::TimeWithZone class with this module.
51
+ #
52
+ # @since 4.4.0
53
+ ActiveSupport::TimeWithZone.send(:include, TimeWithZone)
54
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2016 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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 = "4.3.0".freeze
16
+ VERSION = "4.4.1".freeze
17
17
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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.
@@ -196,6 +196,18 @@ describe BSON::ByteBuffer do
196
196
  it 'increments the write position by 1' do
197
197
  expect(modified.write_position).to eq(1)
198
198
  end
199
+
200
+ context 'when it receives a numeric value' do
201
+ it 'raises the ArgumentError exception' do
202
+ expect{buffer.put_byte(1)}.to raise_error(ArgumentError)
203
+ end
204
+ end
205
+
206
+ context 'when it receives a nil value' do
207
+ it 'raises the ArgumentError exception' do
208
+ expect{buffer.put_byte(nil)}.to raise_error(ArgumentError)
209
+ end
210
+ end
199
211
  end
200
212
 
201
213
  describe '#put_cstring' do
@@ -501,4 +513,32 @@ describe BSON::ByteBuffer do
501
513
  it_behaves_like 'a rewindable buffer'
502
514
  end
503
515
  end
516
+
517
+ describe '#put_bytes' do
518
+
519
+ let(:buffer) do
520
+ described_class.new
521
+ end
522
+
523
+ let!(:modified) do
524
+ buffer.put_bytes(BSON::Int32::BSON_TYPE)
525
+ buffer
526
+ end
527
+
528
+ it 'increments the write position by 1' do
529
+ expect(modified.write_position).to eq(1)
530
+ end
531
+
532
+ context 'when it receives a numeric value' do
533
+ it 'raises the ArgumentError exception' do
534
+ expect{buffer.put_bytes(1)}.to raise_error(ArgumentError)
535
+ end
536
+ end
537
+
538
+ context 'when it receives a nil value' do
539
+ it 'raises the ArgumentError exception' do
540
+ expect{buffer.put_bytes(nil)}.to raise_error(ArgumentError)
541
+ end
542
+ end
543
+ end
504
544
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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-2014 MongoDB Inc.
1
+ # Copyright (C) 2009-2019 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) 2016 MongoDB Inc.
1
+ # Copyright (C) 2016-2019 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-2014 MongoDB Inc.
3
+ # Copyright (C) 2009-2019 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.
@@ -49,6 +49,36 @@ describe BSON::Document do
49
49
  end
50
50
  end
51
51
 
52
+ describe "#fetch" do
53
+
54
+ let(:document) do
55
+ described_class["key", "value", "key2", "value"]
56
+ end
57
+
58
+ context "when provided string keys" do
59
+
60
+ it "returns the value" do
61
+ expect(document.fetch("key")).to eq("value")
62
+ end
63
+ end
64
+
65
+ context "when provided symbol keys" do
66
+
67
+ it "returns the value" do
68
+ expect(document.fetch(:key)).to eq("value")
69
+ end
70
+ end
71
+
72
+ context "when key does not exist" do
73
+
74
+ it "raises KeyError" do
75
+ expect do
76
+ document.fetch(:non_existent_key)
77
+ end.to raise_exception(KeyError)
78
+ end
79
+ end
80
+ end
81
+
52
82
  describe "#[]" do
53
83
 
54
84
  let(:document) do
@@ -68,6 +98,13 @@ describe BSON::Document do
68
98
  expect(document[:key]).to eq("value")
69
99
  end
70
100
  end
101
+
102
+ context "when key does not exist" do
103
+
104
+ it "returns nil" do
105
+ expect(document[:non_existent_key]).to be nil
106
+ end
107
+ end
71
108
  end
72
109
 
73
110
  describe "#[]=" do
@@ -118,6 +155,28 @@ describe BSON::Document do
118
155
  end
119
156
  end
120
157
 
158
+ if described_class.instance_methods.include?(:slice)
159
+ describe "#slice" do
160
+ let(:document) do
161
+ described_class.new("key1" => "value1", key2: "value2")
162
+ end
163
+
164
+ context "when provided string keys" do
165
+
166
+ it "returns the partial document" do
167
+ expect(document.slice("key1")).to contain_exactly(['key1', 'value1'])
168
+ end
169
+ end
170
+
171
+ context "when provided symbol keys" do
172
+
173
+ it "returns the partial document" do
174
+ expect(document.slice(:key1)).to contain_exactly(['key1', 'value1'])
175
+ end
176
+ end
177
+ end
178
+ end
179
+
121
180
  describe "#delete" do
122
181
 
123
182
  shared_examples_for "a document with deletable pairs" do