iiif-presentation 1.4.2 → 1.5.0

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +8 -1
  3. data/.standard.yml +1 -0
  4. data/Gemfile +5 -5
  5. data/README.md +1 -1
  6. data/Rakefile +4 -2
  7. data/VERSION +1 -1
  8. data/bin/standardrb +16 -0
  9. data/iiif-presentation.gemspec +23 -23
  10. data/lib/iiif/hash_behaviours.rb +29 -33
  11. data/lib/iiif/ordered_hash.rb +33 -33
  12. data/lib/iiif/presentation/abstract_resource.rb +17 -22
  13. data/lib/iiif/presentation/annotation.rb +9 -11
  14. data/lib/iiif/presentation/annotation_list.rb +8 -10
  15. data/lib/iiif/presentation/canvas.rb +11 -13
  16. data/lib/iiif/presentation/collection.rb +7 -9
  17. data/lib/iiif/presentation/image_resource.rb +33 -35
  18. data/lib/iiif/presentation/layer.rb +8 -10
  19. data/lib/iiif/presentation/manifest.rb +9 -12
  20. data/lib/iiif/presentation/range.rb +8 -10
  21. data/lib/iiif/presentation/resource.rb +5 -7
  22. data/lib/iiif/presentation/sequence.rb +8 -11
  23. data/lib/iiif/presentation/service.rb +1 -2
  24. data/lib/iiif/presentation.rb +7 -7
  25. data/lib/iiif/service.rb +121 -102
  26. data/lib/iiif/v3/abstract_resource.rb +127 -130
  27. data/lib/iiif/v3/presentation/annotation.rb +20 -21
  28. data/lib/iiif/v3/presentation/annotation_collection.rb +7 -9
  29. data/lib/iiif/v3/presentation/annotation_page.rb +14 -15
  30. data/lib/iiif/v3/presentation/canvas.rb +21 -22
  31. data/lib/iiif/v3/presentation/choice.rb +14 -15
  32. data/lib/iiif/v3/presentation/collection.rb +7 -8
  33. data/lib/iiif/v3/presentation/image_resource.rb +21 -22
  34. data/lib/iiif/v3/presentation/manifest.rb +18 -19
  35. data/lib/iiif/v3/presentation/nav_place.rb +125 -29
  36. data/lib/iiif/v3/presentation/range.rb +10 -10
  37. data/lib/iiif/v3/presentation/resource.rb +4 -5
  38. data/lib/iiif/v3/presentation/sequence.rb +10 -11
  39. data/lib/iiif/v3/presentation/service.rb +12 -13
  40. data/lib/iiif/v3/presentation.rb +8 -8
  41. data/spec/integration/iiif/presentation/image_resource_spec.rb +54 -58
  42. data/spec/integration/iiif/service_spec.rb +76 -77
  43. data/spec/integration/iiif/v3/abstract_resource_spec.rb +72 -73
  44. data/spec/integration/iiif/v3/presentation/image_resource_spec.rb +53 -56
  45. data/spec/spec_helper.rb +56 -64
  46. data/spec/unit/iiif/hash_behaviours_spec.rb +384 -387
  47. data/spec/unit/iiif/ordered_hash_spec.rb +86 -91
  48. data/spec/unit/iiif/presentation/abstract_resource_spec.rb +64 -70
  49. data/spec/unit/iiif/presentation/annotation_list_spec.rb +1 -3
  50. data/spec/unit/iiif/presentation/annotation_spec.rb +1 -3
  51. data/spec/unit/iiif/presentation/canvas_spec.rb +11 -14
  52. data/spec/unit/iiif/presentation/collection_spec.rb +26 -33
  53. data/spec/unit/iiif/presentation/image_resource_spec.rb +4 -6
  54. data/spec/unit/iiif/presentation/layer_spec.rb +16 -20
  55. data/spec/unit/iiif/presentation/manifest_spec.rb +45 -48
  56. data/spec/unit/iiif/presentation/range_spec.rb +18 -22
  57. data/spec/unit/iiif/presentation/resource_spec.rb +3 -6
  58. data/spec/unit/iiif/presentation/sequence_spec.rb +58 -63
  59. data/spec/unit/iiif/presentation/shared_examples/abstract_resource_only_keys.rb +4 -10
  60. data/spec/unit/iiif/presentation/shared_examples/any_type_keys.rb +5 -9
  61. data/spec/unit/iiif/presentation/shared_examples/array_only_keys.rb +9 -17
  62. data/spec/unit/iiif/presentation/shared_examples/int_only_keys.rb +6 -14
  63. data/spec/unit/iiif/presentation/shared_examples/string_only_keys.rb +6 -13
  64. data/spec/unit/iiif/service_spec.rb +8 -13
  65. data/spec/unit/iiif/v3/abstract_resource_define_methods_for_spec.rb +39 -37
  66. data/spec/unit/iiif/v3/abstract_resource_spec.rb +124 -131
  67. data/spec/unit/iiif/v3/presentation/annotation_collection_spec.rb +14 -17
  68. data/spec/unit/iiif/v3/presentation/annotation_page_spec.rb +71 -69
  69. data/spec/unit/iiif/v3/presentation/annotation_spec.rb +249 -233
  70. data/spec/unit/iiif/v3/presentation/canvas_spec.rb +211 -193
  71. data/spec/unit/iiif/v3/presentation/choice_spec.rb +81 -77
  72. data/spec/unit/iiif/v3/presentation/collection_spec.rb +24 -29
  73. data/spec/unit/iiif/v3/presentation/image_resource_spec.rb +70 -71
  74. data/spec/unit/iiif/v3/presentation/manifest_spec.rb +248 -235
  75. data/spec/unit/iiif/v3/presentation/nav_place_spec.rb +249 -49
  76. data/spec/unit/iiif/v3/presentation/range_spec.rb +28 -29
  77. data/spec/unit/iiif/v3/presentation/resource_spec.rb +83 -82
  78. data/spec/unit/iiif/v3/presentation/sequence_spec.rb +125 -119
  79. data/spec/unit/iiif/v3/presentation/service_spec.rb +123 -124
  80. data/spec/unit/iiif/v3/presentation/shared_examples/abstract_resource_only_keys.rb +4 -8
  81. data/spec/unit/iiif/v3/presentation/shared_examples/any_type_keys.rb +5 -7
  82. data/spec/unit/iiif/v3/presentation/shared_examples/array_only_keys.rb +9 -13
  83. data/spec/unit/iiif/v3/presentation/shared_examples/hash_only_keys.rb +9 -13
  84. data/spec/unit/iiif/v3/presentation/shared_examples/int_only_keys.rb +6 -10
  85. data/spec/unit/iiif/v3/presentation/shared_examples/numeric_only_keys.rb +6 -10
  86. data/spec/unit/iiif/v3/presentation/shared_examples/string_only_keys.rb +6 -10
  87. data/spec/unit/iiif/v3/presentation/shared_examples/uri_only_keys.rb +9 -13
  88. metadata +26 -65
@@ -1,12 +1,12 @@
1
- require File.join(File.dirname(__FILE__), '../../spec_helper')
2
- require 'active_support/ordered_hash'
1
+ require File.join(File.dirname(__FILE__), "../../spec_helper")
2
+ require "active_support/ordered_hash"
3
3
  describe IIIF::HashBehaviours do
4
-
5
4
  let(:hash_like_class) do
6
5
  Class.new do
7
6
  include IIIF::HashBehaviours
7
+
8
8
  attr_accessor :data # Accessible for easier expects...not sure you'd do this in a real class
9
- def initialize()
9
+ def initialize
10
10
  @data = IIIF::OrderedHash.new
11
11
  end
12
12
  end
@@ -15,291 +15,290 @@ describe IIIF::HashBehaviours do
15
15
  # TODO: let(:init_data)...rather than repeating so much below
16
16
  subject { hash_like_class.new }
17
17
 
18
- describe '#[]=' do
19
- it 'assigns a new k and value to the node' do
20
- subject['foo'] = 'bar'
21
- expect(subject.data).to eq({'foo' => 'bar'})
22
- end
23
- it 'always puts new entries at the end' do
24
- subject['baz'] = 'qux'
25
- subject['quux'] = 'corge'
26
- subject['grault'] = 'garply'
27
- expect(subject.data[subject.data.keys.last]).to eq 'garply'
28
- end
29
- it 'replaces keys that already exist in the same place' do
30
- subject['waldo'] = 'fred'
31
- subject['plugh'] = 'xyzzy'
32
- subject['thud'] = 'wibble'
33
- subject['plugh'] = 'wobble'
34
- expect(subject.data.select {|k,v| k == 'plugh'}).to eq({'plugh'=>'wobble'})
18
+ describe "#[]=" do
19
+ it "assigns a new k and value to the node" do
20
+ subject["foo"] = "bar"
21
+ expect(subject.data).to eq({"foo" => "bar"})
22
+ end
23
+ it "always puts new entries at the end" do
24
+ subject["baz"] = "qux"
25
+ subject["quux"] = "corge"
26
+ subject["grault"] = "garply"
27
+ expect(subject.data[subject.data.keys.last]).to eq "garply"
28
+ end
29
+ it "replaces keys that already exist in the same place" do
30
+ subject["waldo"] = "fred"
31
+ subject["plugh"] = "xyzzy"
32
+ subject["thud"] = "wibble"
33
+ subject["plugh"] = "wobble"
34
+ expect(subject.data.slice("plugh")).to eq({"plugh" => "wobble"})
35
35
  end
36
36
  end
37
37
 
38
- describe '#[]' do
39
- it 'retrieves the expected value' do
40
- subject['wibble'] = 'wobble'
41
- subject['wubble'] = 'fred'
42
- expect(subject['wibble']).to eq 'wobble'
38
+ describe "#[]" do
39
+ it "retrieves the expected value" do
40
+ subject["wibble"] = "wobble"
41
+ subject["wubble"] = "fred"
42
+ expect(subject["wibble"]).to eq "wobble"
43
43
  end
44
- it 'returns nil if the key is not found' do
45
- subject['wibble'] = 'wobble'
46
- subject['wubble'] = 'fred'
47
- expect(subject['flob']).to be_nil
44
+ it "returns nil if the key is not found" do
45
+ subject["wibble"] = "wobble"
46
+ subject["wubble"] = "fred"
47
+ expect(subject["flob"]).to be_nil
48
48
  end
49
49
  end
50
50
 
51
- describe '#clear' do
52
- it 'clears all properties' do
53
- subject['wibble'] = 'wobble'
54
- subject['wubble'] = 'fred'
51
+ describe "#clear" do
52
+ it "clears all properties" do
53
+ subject["wibble"] = "wobble"
54
+ subject["wubble"] = "fred"
55
55
  subject.clear
56
56
  expect(subject.keys).to eq []
57
57
  end
58
- it 'returns the instance on which it was called' do
59
- subject['wibble'] = 'wobble'
60
- subject['wubble'] = 'fred'
58
+ it "returns the instance on which it was called" do
59
+ subject["wibble"] = "wobble"
60
+ subject["wubble"] = "fred"
61
61
  expect(subject.clear).to eq subject
62
62
  end
63
63
  end
64
64
 
65
- describe '#delete' do
66
- it 'removes an entry from the object' do
67
- subject['waldo'] = 'fred'
68
- subject['plugh'] = 'xyzzy'
69
- subject.delete('waldo')
70
- expect(subject.data).to eq({'plugh' => 'xyzzy'})
71
- end
72
- it 'returns the value of the entry that was removed' do
73
- subject['waldo'] = 'fred'
74
- subject['plugh'] = 'xyzzy'
75
- expect(subject.delete('waldo')).to eq 'fred'
76
- end
77
- it 'can take a block as well' do
78
- subject['waldo'] = 'fred'
79
- subject['plugh'] = 'xyzzy'
80
- expect { |b| subject.delete('wubble', &b) }.to yield_with_args
81
- expect(subject.delete('foo') {|e| e.reverse }).to eq 'oof'
65
+ describe "#delete" do
66
+ it "removes an entry from the object" do
67
+ subject["waldo"] = "fred"
68
+ subject["plugh"] = "xyzzy"
69
+ subject.delete("waldo")
70
+ expect(subject.data).to eq({"plugh" => "xyzzy"})
71
+ end
72
+ it "returns the value of the entry that was removed" do
73
+ subject["waldo"] = "fred"
74
+ subject["plugh"] = "xyzzy"
75
+ expect(subject.delete("waldo")).to eq "fred"
76
+ end
77
+ it "can take a block as well" do
78
+ subject["waldo"] = "fred"
79
+ subject["plugh"] = "xyzzy"
80
+ expect { |b| subject.delete("wubble", &b) }.to yield_with_args
81
+ expect(subject.delete("foo") { |e| e.reverse }).to eq "oof"
82
82
  end
83
83
  end
84
84
 
85
- describe '#delete_if' do
86
- it 'can take a block' do
87
- subject['wibble'] = 'foo'
88
- subject['waldo'] = 'fred'
89
- subject['plugh'] = 'xyzzy'
90
- expect { |b| subject.delete_if(&b) }.to yield_successive_args(['wibble', 'foo'], ['waldo', 'fred'], ['plugh', 'xyzzy'])
91
- end
92
- it 'returns the instance' do
93
- subject['wibble'] = 'foo'
94
- subject['waldo'] = 'fred'
95
- subject['plugh'] = 'xyzzy'
96
- expect( subject.delete_if { |k,v| k.start_with?('w') } ).to eq subject
97
- end
98
- it 'works' do
99
- subject['wibble'] = 'foo'
100
- subject['waldo'] = 'fred'
101
- subject['plugh'] = 'xyzzy'
102
- subject.delete_if { |k,v| k.start_with?('w') }
103
- expect(subject.data).to eq({'plugh' => 'xyzzy'})
104
- end
105
- it 'returns an enumerator if no block is supplied' do
106
- subject['wibble'] = 'foo'
107
- subject['waldo'] = 'fred'
108
- subject['plugh'] = 'xyzzy'
85
+ describe "#delete_if" do
86
+ it "can take a block" do
87
+ subject["wibble"] = "foo"
88
+ subject["waldo"] = "fred"
89
+ subject["plugh"] = "xyzzy"
90
+ expect { |b| subject.delete_if(&b) }.to yield_successive_args(["wibble", "foo"], ["waldo", "fred"], ["plugh", "xyzzy"])
91
+ end
92
+ it "returns the instance" do
93
+ subject["wibble"] = "foo"
94
+ subject["waldo"] = "fred"
95
+ subject["plugh"] = "xyzzy"
96
+ expect(subject.delete_if { |k, v| k.start_with?("w") }).to eq subject
97
+ end
98
+ it "works" do
99
+ subject["wibble"] = "foo"
100
+ subject["waldo"] = "fred"
101
+ subject["plugh"] = "xyzzy"
102
+ subject.delete_if { |k, v| k.start_with?("w") }
103
+ expect(subject.data).to eq({"plugh" => "xyzzy"})
104
+ end
105
+ it "returns an enumerator if no block is supplied" do
106
+ subject["wibble"] = "foo"
107
+ subject["waldo"] = "fred"
108
+ subject["plugh"] = "xyzzy"
109
109
  expect(subject.delete_if).to be_a Enumerator
110
110
  end
111
111
  end
112
112
 
113
- describe '#each' do
114
- it 'yields' do
115
- subject['plugh'] = 'xyzzy'
113
+ describe "#each" do
114
+ it "yields" do
115
+ subject["plugh"] = "xyzzy"
116
116
  expect { |b| subject.each(&b) }.to yield_with_args
117
117
  end
118
- it 'returns the instance' do
119
- subject.data['waldo'] = 'fred'
120
- subject.data['plugh'] = 'xyzzy'
121
- expect(subject.each { |k,v| nil }).to eq subject
118
+ it "returns the instance" do
119
+ subject.data["waldo"] = "fred"
120
+ subject.data["plugh"] = "xyzzy"
121
+ expect(subject.each { |k, v| nil }).to eq subject
122
122
  end
123
- it 'loops as expected' do
124
- subject.data['wibble'] = 'foo'
125
- subject.data['waldo'] = 'fred'
126
- subject.data['plugh'] = 'xyzzy'
123
+ it "loops as expected" do
124
+ subject.data["wibble"] = "foo"
125
+ subject.data["waldo"] = "fred"
126
+ subject.data["plugh"] = "xyzzy"
127
127
  capped_keys = []
128
- subject.each { |k,v| capped_keys << k.capitalize }
129
- expect(capped_keys).to eq ['Wibble', 'Waldo', 'Plugh']
128
+ subject.each { |k, v| capped_keys << k.capitalize }
129
+ expect(capped_keys).to eq ["Wibble", "Waldo", "Plugh"]
130
130
  end
131
- it 'returns an enumerator if no block is supplied' do
132
- subject['wibble'] = 'foo'
133
- subject['waldo'] = 'fred'
134
- subject['plugh'] = 'xyzzy'
131
+ it "returns an enumerator if no block is supplied" do
132
+ subject["wibble"] = "foo"
133
+ subject["waldo"] = "fred"
134
+ subject["plugh"] = "xyzzy"
135
135
  expect(subject.delete_if).to be_a Enumerator
136
136
  end
137
137
  end
138
138
 
139
- describe '#each_key' do
140
- it 'yields' do
141
- subject['plugh'] = 'xyzzy'
139
+ describe "#each_key" do
140
+ it "yields" do
141
+ subject["plugh"] = "xyzzy"
142
142
  expect { |b| subject.each_key(&b) }.to yield_with_args
143
143
  end
144
- it 'returns the instance' do
145
- subject.data['waldo'] = 'fred'
146
- subject.data['plugh'] = 'xyzzy'
144
+ it "returns the instance" do
145
+ subject.data["waldo"] = "fred"
146
+ subject.data["plugh"] = "xyzzy"
147
147
  expect(subject.each_key { |k| nil }).to eq subject
148
148
  end
149
- it 'loops as expected' do
150
- subject['wibble'] = 'foo'
151
- subject['waldo'] = 'fred'
152
- subject['plugh'] = 'xyzzy'
149
+ it "loops as expected" do
150
+ subject["wibble"] = "foo"
151
+ subject["waldo"] = "fred"
152
+ subject["plugh"] = "xyzzy"
153
153
  key_accumulator = []
154
154
  subject.each_key { |k| key_accumulator << k }
155
- expect(key_accumulator).to eq ['wibble', 'waldo', 'plugh']
155
+ expect(key_accumulator).to eq ["wibble", "waldo", "plugh"]
156
156
  end
157
- it 'returns an enumerator if no block is supplied' do
158
- subject['wibble'] = 'foo'
159
- subject['waldo'] = 'fred'
160
- subject['plugh'] = 'xyzzy'
157
+ it "returns an enumerator if no block is supplied" do
158
+ subject["wibble"] = "foo"
159
+ subject["waldo"] = "fred"
160
+ subject["plugh"] = "xyzzy"
161
161
  expect(subject.each_key).to be_a Enumerator
162
162
  end
163
163
  end
164
164
 
165
- describe '#each_value' do
166
- it 'yields' do
167
- subject['plugh'] = 'xyzzy'
165
+ describe "#each_value" do
166
+ it "yields" do
167
+ subject["plugh"] = "xyzzy"
168
168
  expect { |b| subject.each_value(&b) }.to yield_with_args
169
169
  end
170
- it 'returns the instance' do
171
- subject.data['waldo'] = 'fred'
172
- subject.data['plugh'] = 'xyzzy'
170
+ it "returns the instance" do
171
+ subject.data["waldo"] = "fred"
172
+ subject.data["plugh"] = "xyzzy"
173
173
  expect(subject.each_value { |v| nil }).to eq subject
174
174
  end
175
- it 'loops as expected' do
176
- subject['wibble'] = 'foo'
177
- subject['waldo'] = 'fred'
178
- subject['plugh'] = 'xyzzy'
175
+ it "loops as expected" do
176
+ subject["wibble"] = "foo"
177
+ subject["waldo"] = "fred"
178
+ subject["plugh"] = "xyzzy"
179
179
  value_accumulator = []
180
180
  subject.each_value { |v| value_accumulator << v }
181
- expect(value_accumulator).to eq ['foo', 'fred', 'xyzzy']
181
+ expect(value_accumulator).to eq ["foo", "fred", "xyzzy"]
182
182
  end
183
- it 'returns an enumerator if no block is supplied' do
184
- subject['wibble'] = 'foo'
185
- subject['waldo'] = 'fred'
186
- subject['plugh'] = 'xyzzy'
183
+ it "returns an enumerator if no block is supplied" do
184
+ subject["wibble"] = "foo"
185
+ subject["waldo"] = "fred"
186
+ subject["plugh"] = "xyzzy"
187
187
  expect(subject.each_value).to be_a Enumerator
188
188
  end
189
-
190
189
  end
191
190
 
192
- describe '#empty' do
193
- it 'returns true when there are no entries' do
191
+ describe "#empty" do
192
+ it "returns true when there are no entries" do
194
193
  expect(subject.empty?).to be_truthy
195
194
  end
196
- it 'returns false when we have data' do
197
- subject['waldo'] = 'fred'
195
+ it "returns false when we have data" do
196
+ subject["waldo"] = "fred"
198
197
  expect(subject.empty?).to be_falsey
199
198
  end
200
199
  end
201
200
 
202
- describe '#fetch' do
203
- it 'retrieves the expected value' do
204
- subject['wibble'] = 'wobble'
205
- subject['wubble'] = 'fred'
206
- expect(subject.fetch('wibble')).to eq 'wobble'
207
- end
208
- it 'returns the default if the key is not found and one is supplied' do
209
- subject['wibble'] = 'wobble'
210
- subject['wubble'] = 'fred'
211
- expect(subject.fetch('flob', 'waldo')).to eq 'waldo'
212
- end
213
- it 'raises a KeyError if the key is not found and no default is supplied' do
214
- expect { subject.fetch('flob') }.to raise_error KeyError
215
- end
216
- it 'can take a block as well' do
217
- subject['wibble'] = 'wobble'
218
- subject['wubble'] = 'fred'
219
- expect(subject.fetch('wubble') {|e| e.capitalize }).to eq 'fred' # value takes precence
220
- expect { |b| subject.fetch('foo', &b) }.to yield_with_args
221
- expect(subject.fetch('foo') {|e| e.reverse }).to eq 'oof'
201
+ describe "#fetch" do
202
+ it "retrieves the expected value" do
203
+ subject["wibble"] = "wobble"
204
+ subject["wubble"] = "fred"
205
+ expect(subject.fetch("wibble")).to eq "wobble"
206
+ end
207
+ it "returns the default if the key is not found and one is supplied" do
208
+ subject["wibble"] = "wobble"
209
+ subject["wubble"] = "fred"
210
+ expect(subject.fetch("flob", "waldo")).to eq "waldo"
211
+ end
212
+ it "raises a KeyError if the key is not found and no default is supplied" do
213
+ expect { subject.fetch("flob") }.to raise_error KeyError
214
+ end
215
+ it "can take a block as well" do
216
+ subject["wibble"] = "wobble"
217
+ subject["wubble"] = "fred"
218
+ expect(subject.fetch("wubble") { |e| e.capitalize }).to eq "fred" # value takes precence
219
+ expect { |b| subject.fetch("foo", &b) }.to yield_with_args
220
+ expect(subject.fetch("foo") { |e| e.reverse }).to eq "oof"
222
221
  end
223
222
  end
224
223
 
225
- describe '#has_key? (and aliases)' do
226
- it 'is true when the key exists' do
227
- subject['wibble'] = 'wobble'
228
- expect(subject.has_key? 'wibble').to be_truthy
224
+ describe "#has_key? (and aliases)" do
225
+ it "is true when the key exists" do
226
+ subject["wibble"] = "wobble"
227
+ expect(subject.has_key?("wibble")).to be_truthy
229
228
  end
230
- it 'is false when the key does not exist' do
231
- expect(subject.has_key? 'wibble').to be_falsey
229
+ it "is false when the key does not exist" do
230
+ expect(subject.has_key?("wibble")).to be_falsey
232
231
  end
233
232
  end
234
233
 
235
- describe '#has_value? (and aliases)' do
236
- it 'is true when the value exists' do
237
- subject['wibble'] = 'wobble'
238
- expect(subject.has_value? 'wobble').to be_truthy
234
+ describe "#has_value? (and aliases)" do
235
+ it "is true when the value exists" do
236
+ subject["wibble"] = "wobble"
237
+ expect(subject.has_value?("wobble")).to be_truthy
239
238
  end
240
- it 'is false when the value does not exist' do
241
- expect(subject.has_value? 'wobble').to be_falsey
239
+ it "is false when the value does not exist" do
240
+ expect(subject.has_value?("wobble")).to be_falsey
242
241
  end
243
242
  end
244
243
 
245
- describe '#keep_if' do
246
- it 'can take a block' do
247
- subject['wibble'] = 'foo'
248
- subject['waldo'] = 'fred'
249
- subject['plugh'] = 'xyzzy'
250
- expect { |b| subject.keep_if(&b) }.to yield_successive_args(['wibble', 'foo'], ['waldo', 'fred'], ['plugh', 'xyzzy'])
251
- end
252
- it 'returns the instance' do
253
- subject['wibble'] = 'foo'
254
- subject['waldo'] = 'fred'
255
- subject['plugh'] = 'xyzzy'
256
- expect( subject.keep_if { |k,v| k.start_with?('w') } ).to eq subject
257
- end
258
- it 'works' do
259
- subject['wibble'] = 'foo'
260
- subject['waldo'] = 'fred'
261
- subject['plugh'] = 'xyzzy'
262
- subject.keep_if { |k,v| k.start_with?('w') }
263
- expect(subject.data).to eq({'wibble'=>'foo', 'waldo'=>'fred'})
244
+ describe "#keep_if" do
245
+ it "can take a block" do
246
+ subject["wibble"] = "foo"
247
+ subject["waldo"] = "fred"
248
+ subject["plugh"] = "xyzzy"
249
+ expect { |b| subject.keep_if(&b) }.to yield_successive_args(["wibble", "foo"], ["waldo", "fred"], ["plugh", "xyzzy"])
250
+ end
251
+ it "returns the instance" do
252
+ subject["wibble"] = "foo"
253
+ subject["waldo"] = "fred"
254
+ subject["plugh"] = "xyzzy"
255
+ expect(subject.keep_if { |k, v| k.start_with?("w") }).to eq subject
256
+ end
257
+ it "works" do
258
+ subject["wibble"] = "foo"
259
+ subject["waldo"] = "fred"
260
+ subject["plugh"] = "xyzzy"
261
+ subject.keep_if { |k, v| k.start_with?("w") }
262
+ expect(subject.data).to eq({"wibble" => "foo", "waldo" => "fred"})
264
263
  end
265
264
  end
266
265
 
267
- describe '#key' do
268
- it 'is the key associated with a value' do
269
- subject['thud'] = 'wibble'
270
- subject['plugh'] = 'wobble'
271
- expect(subject.key 'wibble').to eq 'thud'
272
- expect(subject.key 'wobble').to eq 'plugh'
273
- end
274
- it 'is nil if the value is not found' do
275
- subject['thud'] = 'wibble'
276
- subject['plugh'] = 'wobble'
277
- expect(subject.key 'foo').to be_nil
266
+ describe "#key" do
267
+ it "is the key associated with a value" do
268
+ subject["thud"] = "wibble"
269
+ subject["plugh"] = "wobble"
270
+ expect(subject.key("wibble")).to eq "thud"
271
+ expect(subject.key("wobble")).to eq "plugh"
272
+ end
273
+ it "is nil if the value is not found" do
274
+ subject["thud"] = "wibble"
275
+ subject["plugh"] = "wobble"
276
+ expect(subject.key("foo")).to be_nil
278
277
  end
279
278
  end
280
279
 
281
- describe '#keys' do
282
- it 'is an array of all of the keys in the object' do
283
- subject['foo'] = 'bar'
284
- subject['waldo'] = 'fred'
285
- subject['plugh'] = 'xyzzy'
286
- expect(subject.keys).to eq ['foo', 'waldo', 'plugh']
280
+ describe "#keys" do
281
+ it "is an array of all of the keys in the object" do
282
+ subject["foo"] = "bar"
283
+ subject["waldo"] = "fred"
284
+ subject["plugh"] = "xyzzy"
285
+ expect(subject.keys).to eq ["foo", "waldo", "plugh"]
287
286
  end
288
287
  end
289
288
 
290
- describe '#length' do
291
- it 'works' do
292
- subject['wibble'] = 'foo'
293
- subject['waldo'] = 'fred'
289
+ describe "#length" do
290
+ it "works" do
291
+ subject["wibble"] = "foo"
292
+ subject["waldo"] = "fred"
294
293
  expect(subject.length).to eq 2
295
294
  end
296
295
  end
297
296
 
298
- describe '#merge' do
299
- it 'returns a new instance of the calling class' do
300
- subject['wibble'] = 'foo'
297
+ describe "#merge" do
298
+ it "returns a new instance of the calling class" do
299
+ subject["wibble"] = "foo"
301
300
  another = hash_like_class.new
302
- another['waldo'] = 'fred'
301
+ another["waldo"] = "fred"
303
302
  merged = subject.merge(another)
304
303
  # clear them all to confirm we're not testing equality of anything other
305
304
  # than that we have different instances
@@ -318,33 +317,33 @@ describe IIIF::HashBehaviours do
318
317
  # new_instance = subject.merge(another)
319
318
  # expect(new_instance.data.last).to eq ['waldo', 'fred']
320
319
  # end
321
- it 'retains the index position for existing entries, replacing the value' do
322
- subject['wibble'] = 'foo'
323
- subject['plugh'] = 'xyzzy'
324
- subject['foo'] = 'bar'
320
+ it "retains the index position for existing entries, replacing the value" do
321
+ subject["wibble"] = "foo"
322
+ subject["plugh"] = "xyzzy"
323
+ subject["foo"] = "bar"
325
324
  another = hash_like_class.new
326
- another['plugh'] = 'fred'
325
+ another["plugh"] = "fred"
327
326
  new_instance = subject.merge(another)
328
- expect(new_instance['plugh']).to eq 'fred'
329
- expect(new_instance[new_instance.keys[1]]).to eq 'fred'
327
+ expect(new_instance["plugh"]).to eq "fred"
328
+ expect(new_instance[new_instance.keys[1]]).to eq "fred"
330
329
  end
331
- it 'takes a block' do
332
- subject['wibble'] = 'foo'
333
- subject['plugh'] = 'xyzzy'
334
- subject['foo'] = 'bar'
330
+ it "takes a block" do
331
+ subject["wibble"] = "foo"
332
+ subject["plugh"] = "xyzzy"
333
+ subject["foo"] = "bar"
335
334
  another = hash_like_class.new
336
- another['plugh'] = 'fred'
335
+ another["plugh"] = "fred"
337
336
  # e.g. give a block that turns common keys into an Array
338
- new_instance = subject.merge(another) { |k, old_val,new_val| [old_val, new_val] }
339
- expect(new_instance['wibble']).to eq 'foo'
340
- expect(new_instance['plugh']).to eq ['xyzzy', 'fred']
341
- expect(new_instance['foo']).to eq 'bar'
342
- expect(new_instance.data).to eq({'wibble'=>'foo', 'plugh'=>['xyzzy', 'fred'], 'foo'=>'bar'})
343
- end
344
- describe 'takes anything that implements `#each { |k,v| block }` and #has_key?' do
345
- it 'returns a new instance of the calling class' do
346
- subject['wibble'] = 'foo'
347
- another = {'waldo' => 'fred'}
337
+ new_instance = subject.merge(another) { |k, old_val, new_val| [old_val, new_val] }
338
+ expect(new_instance["wibble"]).to eq "foo"
339
+ expect(new_instance["plugh"]).to eq ["xyzzy", "fred"]
340
+ expect(new_instance["foo"]).to eq "bar"
341
+ expect(new_instance.data).to eq({"wibble" => "foo", "plugh" => ["xyzzy", "fred"], "foo" => "bar"})
342
+ end
343
+ describe "takes anything that implements `#each { |k,v| block }` and #has_key?" do
344
+ it "returns a new instance of the calling class" do
345
+ subject["wibble"] = "foo"
346
+ another = {"waldo" => "fred"}
348
347
  merged = subject.merge(another)
349
348
  # clear them all to confirm we're not testing equality of anything other
350
349
  # than that we have different instances
@@ -362,208 +361,206 @@ describe IIIF::HashBehaviours do
362
361
  # new_instance = subject.merge(another)
363
362
  # expect(new_instance.data.last).to eq ['waldo', 'fred']
364
363
  # end
365
- it 'retains the index position for existing entries, replacing the value' do
366
- subject['wibble'] = 'foo'
367
- subject['plugh'] = 'xyzzy'
368
- subject['foo'] = 'bar'
369
- another = {'plugh' => 'fred' }
370
- another['plugh'] = 'fred'
364
+ it "retains the index position for existing entries, replacing the value" do
365
+ subject["wibble"] = "foo"
366
+ subject["plugh"] = "xyzzy"
367
+ subject["foo"] = "bar"
368
+ another = {"plugh" => "fred"}
369
+ another["plugh"] = "fred"
371
370
  new_instance = subject.merge(another)
372
- expect(new_instance['plugh']).to eq 'fred'
373
- expect(new_instance[new_instance.keys[1]]).to eq 'fred'
371
+ expect(new_instance["plugh"]).to eq "fred"
372
+ expect(new_instance[new_instance.keys[1]]).to eq "fred"
374
373
  end
375
- it 'takes a block' do
376
- subject['wibble'] = 'foo'
377
- subject['plugh'] = 'xyzzy'
378
- subject['foo'] = 'bar'
379
- another = {'plugh' => 'fred'}
374
+ it "takes a block" do
375
+ subject["wibble"] = "foo"
376
+ subject["plugh"] = "xyzzy"
377
+ subject["foo"] = "bar"
378
+ another = {"plugh" => "fred"}
380
379
  # e.g. give a block that turns common keys into an Array
381
- new_instance = subject.merge(another) { |k, old_val,new_val| [old_val, new_val] }
382
- expect(new_instance['wibble']).to eq 'foo'
383
- expect(new_instance['plugh']).to eq ['xyzzy', 'fred']
384
- expect(new_instance['foo']).to eq 'bar'
385
- expect(new_instance.data).to eq({'wibble'=>'foo', 'plugh'=>['xyzzy', 'fred'], 'foo'=>'bar'})
380
+ new_instance = subject.merge(another) { |k, old_val, new_val| [old_val, new_val] }
381
+ expect(new_instance["wibble"]).to eq "foo"
382
+ expect(new_instance["plugh"]).to eq ["xyzzy", "fred"]
383
+ expect(new_instance["foo"]).to eq "bar"
384
+ expect(new_instance.data).to eq({"wibble" => "foo", "plugh" => ["xyzzy", "fred"], "foo" => "bar"})
386
385
  end
387
386
  end
388
387
  end
389
388
 
390
- describe '#merge!' do
391
- it 'returns the instance on which is was called' do
392
- subject['wibble'] = 'foo'
389
+ describe "#merge!" do
390
+ it "returns the instance on which is was called" do
391
+ subject["wibble"] = "foo"
393
392
  another = hash_like_class.new
394
- another['waldo'] = 'fred'
393
+ another["waldo"] = "fred"
395
394
  expect(subject.merge!(another)).to eq subject # same instance
396
395
  end
397
- it 'adds new entries to the end' do
398
- subject['wibble'] = 'foo'
399
- subject['plugh'] = 'xyzzy'
396
+ it "adds new entries to the end" do
397
+ subject["wibble"] = "foo"
398
+ subject["plugh"] = "xyzzy"
400
399
  another = hash_like_class.new
401
- another['waldo'] = 'fred'
400
+ another["waldo"] = "fred"
402
401
  subject.merge!(another)
403
- expect(subject.data[subject.data.keys.last]).to eq 'fred'
402
+ expect(subject.data[subject.data.keys.last]).to eq "fred"
404
403
  end
405
- it 'retains the index position for existing entries, replacing the value' do
406
- subject['wibble'] = 'foo'
407
- subject['plugh'] = 'xyzzy'
408
- subject['foo'] = 'bar'
404
+ it "retains the index position for existing entries, replacing the value" do
405
+ subject["wibble"] = "foo"
406
+ subject["plugh"] = "xyzzy"
407
+ subject["foo"] = "bar"
409
408
  another = hash_like_class.new
410
- another['plugh'] = 'fred'
409
+ another["plugh"] = "fred"
411
410
  subject.merge!(another)
412
- expect(subject['plugh']).to eq 'fred'
413
- expect(subject.data[subject.keys[1]]).to eq 'fred'
411
+ expect(subject["plugh"]).to eq "fred"
412
+ expect(subject.data[subject.keys[1]]).to eq "fred"
414
413
  end
415
- it 'takes a block' do
416
- subject['wibble'] = 'foo'
417
- subject['plugh'] = 'xyzzy'
418
- subject['foo'] = 'bar'
414
+ it "takes a block" do
415
+ subject["wibble"] = "foo"
416
+ subject["plugh"] = "xyzzy"
417
+ subject["foo"] = "bar"
419
418
  another = hash_like_class.new
420
- another['plugh'] = 'fred'
419
+ another["plugh"] = "fred"
421
420
  # e.g. give a block that turns common keys into an Array
422
- subject.merge!(another) { |k, old_val,new_val| [old_val, new_val] }
423
- expect(subject['wibble']).to eq 'foo'
424
- expect(subject['plugh']).to eq ['xyzzy', 'fred']
425
- expect(subject['foo']).to eq 'bar'
426
- expect(subject.data).to eq({'wibble'=>'foo', 'plugh'=>['xyzzy', 'fred'], 'foo'=>'bar'})
427
- end
428
- describe 'takes anything that implements `#each { |k,v| block }` and #has_key?' do
429
- it 'returns a new instance of the calling class' do
430
- subject['wibble'] = 'foo'
431
- another = {'waldo' => 'fred'}
421
+ subject.merge!(another) { |k, old_val, new_val| [old_val, new_val] }
422
+ expect(subject["wibble"]).to eq "foo"
423
+ expect(subject["plugh"]).to eq ["xyzzy", "fred"]
424
+ expect(subject["foo"]).to eq "bar"
425
+ expect(subject.data).to eq({"wibble" => "foo", "plugh" => ["xyzzy", "fred"], "foo" => "bar"})
426
+ end
427
+ describe "takes anything that implements `#each { |k,v| block }` and #has_key?" do
428
+ it "returns a new instance of the calling class" do
429
+ subject["wibble"] = "foo"
430
+ another = {"waldo" => "fred"}
432
431
  expect(subject.merge!(another)).to eq subject # same instance
433
432
  end
434
- it 'adds new entries to the end' do
435
- subject['wibble'] = 'foo'
436
- subject['plugh'] = 'xyzzy'
437
- another = {'waldo' => 'fred'}
433
+ it "adds new entries to the end" do
434
+ subject["wibble"] = "foo"
435
+ subject["plugh"] = "xyzzy"
436
+ another = {"waldo" => "fred"}
438
437
  subject.merge!(another)
439
- expect(subject.data[subject.data.keys.last]).to eq 'fred'
438
+ expect(subject.data[subject.data.keys.last]).to eq "fred"
440
439
  end
441
- it 'retains the index position for existing entries, replacing the value' do
442
- subject['wibble'] = 'foo'
443
- subject['plugh'] = 'xyzzy'
444
- subject['foo'] = 'bar'
445
- another = {'plugh' => 'fred' }
440
+ it "retains the index position for existing entries, replacing the value" do
441
+ subject["wibble"] = "foo"
442
+ subject["plugh"] = "xyzzy"
443
+ subject["foo"] = "bar"
444
+ another = {"plugh" => "fred"}
446
445
  subject.merge!(another)
447
- expect(subject['plugh']).to eq 'fred'
448
- expect(subject.data[subject.keys[1]]).to eq 'fred'
446
+ expect(subject["plugh"]).to eq "fred"
447
+ expect(subject.data[subject.keys[1]]).to eq "fred"
449
448
  end
450
- it 'takes a block' do
451
- subject['wibble'] = 'foo'
452
- subject['plugh'] = 'xyzzy'
453
- subject['foo'] = 'bar'
454
- another = {'plugh' => 'fred'}
455
- subject.merge!(another) { |k, old_val,new_val| "#{k}, #{old_val}, #{new_val}" }
456
- expect(subject['wibble']).to eq 'foo'
457
- expect(subject['plugh']).to eq 'plugh, xyzzy, fred'
458
- expect(subject['foo']).to eq 'bar'
459
- expect(subject.data).to eq({'wibble'=>'foo', 'plugh'=>'plugh, xyzzy, fred', 'foo'=>'bar'})
449
+ it "takes a block" do
450
+ subject["wibble"] = "foo"
451
+ subject["plugh"] = "xyzzy"
452
+ subject["foo"] = "bar"
453
+ another = {"plugh" => "fred"}
454
+ subject.merge!(another) { |k, old_val, new_val| "#{k}, #{old_val}, #{new_val}" }
455
+ expect(subject["wibble"]).to eq "foo"
456
+ expect(subject["plugh"]).to eq "plugh, xyzzy, fred"
457
+ expect(subject["foo"]).to eq "bar"
458
+ expect(subject.data).to eq({"wibble" => "foo", "plugh" => "plugh, xyzzy, fred", "foo" => "bar"})
460
459
  end
461
460
  end
462
461
  end
463
462
 
464
- describe '#reject!' do
465
- it 'can take a block' do
466
- subject['wibble'] = 'foo'
467
- subject['waldo'] = 'fred'
468
- subject['plugh'] = 'xyzzy'
469
- expect { |b| subject.reject!(&b) }.to yield_successive_args(['wibble', 'foo'], ['waldo', 'fred'], ['plugh', 'xyzzy'])
470
- end
471
- it 'returns the instance if there were changes' do
472
- subject['wibble'] = 'foo'
473
- subject['waldo'] = 'fred'
474
- subject['plugh'] = 'xyzzy'
475
- expect( subject.reject! { |k| k.start_with?('w') } ).to be subject
476
- end
477
- it 'returns nil if there were no changes' do
478
- subject['wibble'] = 'foo'
479
- subject['waldo'] = 'fred'
480
- subject['plugh'] = 'xyzzy'
481
- expect( subject.reject! { |k| k.start_with?('X') } ).to be_nil
482
- end
483
- it 'works' do
484
- subject['wibble'] = 'foo'
485
- subject['waldo'] = 'fred'
486
- subject['plugh'] = 'xyzzy'
487
- subject.reject! { |k| k.start_with?('w') }
488
- expect(subject.data).to eq({'plugh' => 'xyzzy'})
463
+ describe "#reject!" do
464
+ it "can take a block" do
465
+ subject["wibble"] = "foo"
466
+ subject["waldo"] = "fred"
467
+ subject["plugh"] = "xyzzy"
468
+ expect { |b| subject.reject!(&b) }.to yield_successive_args(["wibble", "foo"], ["waldo", "fred"], ["plugh", "xyzzy"])
469
+ end
470
+ it "returns the instance if there were changes" do
471
+ subject["wibble"] = "foo"
472
+ subject["waldo"] = "fred"
473
+ subject["plugh"] = "xyzzy"
474
+ expect(subject.reject! { |k| k.start_with?("w") }).to be subject
475
+ end
476
+ it "returns nil if there were no changes" do
477
+ subject["wibble"] = "foo"
478
+ subject["waldo"] = "fred"
479
+ subject["plugh"] = "xyzzy"
480
+ expect(subject.reject! { |k| k.start_with?("X") }).to be_nil
481
+ end
482
+ it "works" do
483
+ subject["wibble"] = "foo"
484
+ subject["waldo"] = "fred"
485
+ subject["plugh"] = "xyzzy"
486
+ subject.reject! { |k| k.start_with?("w") }
487
+ expect(subject.data).to eq({"plugh" => "xyzzy"})
489
488
  end
490
489
  end
491
490
 
492
- describe '#select' do
493
- it 'yields' do
494
- subject['thud'] = 'wibble'
495
- subject['plugh'] = 'wobble'
496
- subject['waldo'] = 'fred'
497
- expect { |b| subject.select(&b) }.to yield_successive_args(['thud', 'wibble'], ['plugh', 'wobble'], ['waldo', 'fred'])
498
- end
499
- it 'returns a new instance of the class' do
500
- subject['thud'] = 'wibble'
501
- subject['plugh'] = 'wobble'
502
- subject['waldo'] = 'fred'
503
- expect( subject.select{ |k,v| true }.class ).to eq subject.class
504
- expect( subject.select{ |k,v| true } ).to_not eq subject
505
- end
506
- it 'selects but doesn\'t delete from the original instance' do
507
- subject['thud'] = 'wibble'
508
- subject['plugh'] = 'wobble'
509
- subject['waldo'] = 'fred'
510
- expect( subject.select{ |k,v| k.include?('u') }.data ).to eq({'thud'=>'wibble', 'plugh'=>'wobble'})
511
- expect( subject.data ).to eq subject.data
491
+ describe "#select" do
492
+ it "yields" do
493
+ subject["thud"] = "wibble"
494
+ subject["plugh"] = "wobble"
495
+ subject["waldo"] = "fred"
496
+ expect { |b| subject.select(&b) }.to yield_successive_args(["thud", "wibble"], ["plugh", "wobble"], ["waldo", "fred"])
497
+ end
498
+ it "returns a new instance of the class" do
499
+ subject["thud"] = "wibble"
500
+ subject["plugh"] = "wobble"
501
+ subject["waldo"] = "fred"
502
+ expect(subject.select { |k, v| true }.class).to eq subject.class
503
+ expect(subject.select { |k, v| true }).to_not eq subject
504
+ end
505
+ it "selects but doesn't delete from the original instance" do
506
+ subject["thud"] = "wibble"
507
+ subject["plugh"] = "wobble"
508
+ subject["waldo"] = "fred"
509
+ expect(subject.select { |k, v| k.include?("u") }.data).to eq({"thud" => "wibble", "plugh" => "wobble"})
510
+ expect(subject.data).to eq subject.data
512
511
  end
513
512
  end
514
513
 
515
- describe '#select!' do
516
- it 'can take a block' do
517
- subject['wibble'] = 'foo'
518
- subject['waldo'] = 'fred'
519
- subject['plugh'] = 'xyzzy'
520
- expect { |b| subject.select!(&b) }.to yield_successive_args(['wibble', 'foo'], ['waldo', 'fred'], ['plugh', 'xyzzy'])
521
- end
522
- it 'returns nil if there were no changes' do
523
- subject['wibble'] = 'foo'
524
- subject['waldo'] = 'fred'
525
- subject['wobble'] = 'xyzzy'
526
- expect( subject.select! { |k,v| k.start_with?('w') } ).to be_nil
527
- end
528
- it 'returns the instance if there were changes' do
529
- subject['wibble'] = 'foo'
530
- subject['waldo'] = 'fred'
531
- subject['plugh'] = 'xyzzy'
532
- expect( subject.select! { |k,v| k.start_with?('w') } ).to eq subject
533
- end
534
- it 'works' do
535
- subject['wibble'] = 'foo'
536
- subject['waldo'] = 'fred'
537
- subject['plugh'] = 'xyzzy'
538
- subject.select! { |k,v| k.start_with?('p') }
539
- expect(subject.data).to eq({'plugh' => 'xyzzy'})
514
+ describe "#select!" do
515
+ it "can take a block" do
516
+ subject["wibble"] = "foo"
517
+ subject["waldo"] = "fred"
518
+ subject["plugh"] = "xyzzy"
519
+ expect { |b| subject.select!(&b) }.to yield_successive_args(["wibble", "foo"], ["waldo", "fred"], ["plugh", "xyzzy"])
520
+ end
521
+ it "returns nil if there were no changes" do
522
+ subject["wibble"] = "foo"
523
+ subject["waldo"] = "fred"
524
+ subject["wobble"] = "xyzzy"
525
+ expect(subject.select! { |k, v| k.start_with?("w") }).to be_nil
526
+ end
527
+ it "returns the instance if there were changes" do
528
+ subject["wibble"] = "foo"
529
+ subject["waldo"] = "fred"
530
+ subject["plugh"] = "xyzzy"
531
+ expect(subject.select! { |k, v| k.start_with?("w") }).to eq subject
532
+ end
533
+ it "works" do
534
+ subject["wibble"] = "foo"
535
+ subject["waldo"] = "fred"
536
+ subject["plugh"] = "xyzzy"
537
+ subject.select! { |k, v| k.start_with?("p") }
538
+ expect(subject.data).to eq({"plugh" => "xyzzy"})
540
539
  end
541
540
  end
542
541
 
543
- describe '#shift' do
544
- it 'returns the first element in the hash without a param' do
545
- subject['thud'] = 'wibble'
546
- subject['plugh'] = 'wobble'
547
- expect(subject.shift).to eq ['thud','wibble']
548
- expect(subject.data).to eq({'plugh' => 'wobble'})
542
+ describe "#shift" do
543
+ it "returns the first element in the hash without a param" do
544
+ subject["thud"] = "wibble"
545
+ subject["plugh"] = "wobble"
546
+ expect(subject.shift).to eq ["thud", "wibble"]
547
+ expect(subject.data).to eq({"plugh" => "wobble"})
549
548
  end
550
549
  end
551
550
 
552
- describe 'store' do
553
- it 'works as an alias for []=' do
554
- subject.store('foo', 'bar')
555
- expect(subject.data).to eq({'foo' => 'bar'})
551
+ describe "store" do
552
+ it "works as an alias for []=" do
553
+ subject.store("foo", "bar")
554
+ expect(subject.data).to eq({"foo" => "bar"})
556
555
  end
557
556
  end
558
557
 
559
- describe '#values' do
560
- it 'is an array of all of the keys in the object' do
561
- subject['foo'] = 'bar'
562
- subject['waldo'] = 'fred'
563
- subject['plugh'] = 'xyzzy'
564
- expect(subject.values).to eq ['bar', 'fred', 'xyzzy']
558
+ describe "#values" do
559
+ it "is an array of all of the keys in the object" do
560
+ subject["foo"] = "bar"
561
+ subject["waldo"] = "fred"
562
+ subject["plugh"] = "xyzzy"
563
+ expect(subject.values).to eq ["bar", "fred", "xyzzy"]
565
564
  end
566
565
  end
567
-
568
566
  end
569
-