active-fedora 13.1.0 → 13.2.2

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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +20 -12
  3. data/.github_changelog_generator +2 -0
  4. data/CHANGELOG.md +3362 -0
  5. data/CONTRIBUTING.md +23 -1
  6. data/README.md +4 -0
  7. data/active-fedora.gemspec +13 -13
  8. data/config/fedora.yml +5 -5
  9. data/lib/active_fedora/file.rb +1 -3
  10. data/lib/active_fedora/version.rb +3 -1
  11. data/lib/active_fedora/with_metadata/default_schema.rb +12 -1
  12. data/lib/generators/active_fedora/config/fedora/templates/fedora.yml +6 -6
  13. metadata +99 -216
  14. data/spec/config_helper.rb +0 -17
  15. data/spec/fixtures/dino.jpg +0 -0
  16. data/spec/fixtures/dino_jpg_no_file_ext +0 -0
  17. data/spec/fixtures/minivan.jpg +0 -0
  18. data/spec/fixtures/rails_root/config/fake_fedora.yml +0 -7
  19. data/spec/fixtures/rails_root/config/fedora.yml +0 -12
  20. data/spec/fixtures/rails_root/config/solr.yml +0 -15
  21. data/spec/fixtures/rails_root/config/solr_mappings.yml +0 -16
  22. data/spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml +0 -9
  23. data/spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml +0 -17
  24. data/spec/integration/associations/rdf_spec.rb +0 -61
  25. data/spec/integration/associations_spec.rb +0 -680
  26. data/spec/integration/attached_files_spec.rb +0 -146
  27. data/spec/integration/attributes_spec.rb +0 -73
  28. data/spec/integration/autosave_association_spec.rb +0 -24
  29. data/spec/integration/base_spec.rb +0 -184
  30. data/spec/integration/basic_contains_association_spec.rb +0 -121
  31. data/spec/integration/belongs_to_association_spec.rb +0 -260
  32. data/spec/integration/caching_spec.rb +0 -59
  33. data/spec/integration/clean_connection_spec.rb +0 -21
  34. data/spec/integration/collection_association_spec.rb +0 -166
  35. data/spec/integration/date_time_properties_spec.rb +0 -41
  36. data/spec/integration/delete_all_spec.rb +0 -64
  37. data/spec/integration/direct_container_spec.rb +0 -250
  38. data/spec/integration/directly_contains_one_association_spec.rb +0 -96
  39. data/spec/integration/eradicate_spec.rb +0 -52
  40. data/spec/integration/fedora_solr_sync_spec.rb +0 -30
  41. data/spec/integration/file_fixity_spec.rb +0 -36
  42. data/spec/integration/file_spec.rb +0 -221
  43. data/spec/integration/generators/fedora_generator_spec.rb +0 -26
  44. data/spec/integration/generators/solr_generator_spec.rb +0 -23
  45. data/spec/integration/gone_spec.rb +0 -41
  46. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +0 -414
  47. data/spec/integration/has_many_associations_spec.rb +0 -436
  48. data/spec/integration/has_subresource_spec.rb +0 -34
  49. data/spec/integration/indexing/descendant_fetcher_spec.rb +0 -64
  50. data/spec/integration/indexing_spec.rb +0 -110
  51. data/spec/integration/indirect_container_spec.rb +0 -290
  52. data/spec/integration/json_serialization_spec.rb +0 -32
  53. data/spec/integration/marshal_spec.rb +0 -39
  54. data/spec/integration/nested_attribute_spec.rb +0 -177
  55. data/spec/integration/nested_hash_resources_spec.rb +0 -43
  56. data/spec/integration/persistence_spec.rb +0 -37
  57. data/spec/integration/query_result_builder_spec.rb +0 -37
  58. data/spec/integration/rdf_nested_attributes_spec.rb +0 -85
  59. data/spec/integration/relation_delegation_spec.rb +0 -52
  60. data/spec/integration/relation_spec.rb +0 -117
  61. data/spec/integration/scoped_query_spec.rb +0 -134
  62. data/spec/integration/scoping_spec.rb +0 -48
  63. data/spec/integration/solr_hit_spec.rb +0 -32
  64. data/spec/integration/versionable_spec.rb +0 -256
  65. data/spec/integration/with_metadata_spec.rb +0 -111
  66. data/spec/lib/active_fedora/null_logger_spec.rb +0 -10
  67. data/spec/rcov.opts +0 -2
  68. data/spec/spec.opts +0 -5
  69. data/spec/spec_helper.rb +0 -106
  70. data/spec/support/an_active_model.rb +0 -29
  71. data/spec/unit/active_fedora/indexing/inserter_spec.rb +0 -35
  72. data/spec/unit/active_fedora_spec.rb +0 -118
  73. data/spec/unit/aggregation/list_source_spec.rb +0 -134
  74. data/spec/unit/aggregation/ordered_reader_spec.rb +0 -43
  75. data/spec/unit/association_hash_spec.rb +0 -64
  76. data/spec/unit/attached_files_spec.rb +0 -218
  77. data/spec/unit/attributes_spec.rb +0 -146
  78. data/spec/unit/base_active_model_spec.rb +0 -28
  79. data/spec/unit/base_cma_spec.rb +0 -15
  80. data/spec/unit/base_extra_spec.rb +0 -33
  81. data/spec/unit/base_spec.rb +0 -328
  82. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +0 -8
  83. data/spec/unit/callback_spec.rb +0 -65
  84. data/spec/unit/change_set_spec.rb +0 -60
  85. data/spec/unit/checksum_spec.rb +0 -25
  86. data/spec/unit/code_configurator_spec.rb +0 -41
  87. data/spec/unit/collection_proxy_spec.rb +0 -25
  88. data/spec/unit/config_spec.rb +0 -18
  89. data/spec/unit/core/fedora_id_translator_spec.rb +0 -29
  90. data/spec/unit/core/fedora_uri_translator_spec.rb +0 -19
  91. data/spec/unit/core/logger_spec.rb +0 -18
  92. data/spec/unit/core_spec.rb +0 -242
  93. data/spec/unit/default_model_mapper_spec.rb +0 -39
  94. data/spec/unit/fedora_spec.rb +0 -31
  95. data/spec/unit/file/streaming_spec.rb +0 -33
  96. data/spec/unit/file_configurator_spec.rb +0 -295
  97. data/spec/unit/file_io_spec.rb +0 -137
  98. data/spec/unit/file_path_builder_spec.rb +0 -18
  99. data/spec/unit/file_spec.rb +0 -472
  100. data/spec/unit/files_hash_spec.rb +0 -52
  101. data/spec/unit/filter_spec.rb +0 -133
  102. data/spec/unit/finder_methods_spec.rb +0 -154
  103. data/spec/unit/fixity_service_spec.rb +0 -128
  104. data/spec/unit/forbidden_attributes_protection_spec.rb +0 -50
  105. data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -125
  106. data/spec/unit/has_many_association_spec.rb +0 -131
  107. data/spec/unit/indexers/global_indexer_spec.rb +0 -41
  108. data/spec/unit/indexing/map/index_object_spec.rb +0 -25
  109. data/spec/unit/indexing/map_spec.rb +0 -27
  110. data/spec/unit/indexing_service_spec.rb +0 -28
  111. data/spec/unit/indexing_spec.rb +0 -86
  112. data/spec/unit/inheritance_spec.rb +0 -60
  113. data/spec/unit/ldp_resource_spec.rb +0 -15
  114. data/spec/unit/loadable_from_json_spec.rb +0 -40
  115. data/spec/unit/logger_spec.rb +0 -19
  116. data/spec/unit/model_classifier_spec.rb +0 -49
  117. data/spec/unit/ordered_spec.rb +0 -367
  118. data/spec/unit/orders/list_node_spec.rb +0 -151
  119. data/spec/unit/orders/ordered_list_spec.rb +0 -335
  120. data/spec/unit/orders/reflection_spec.rb +0 -22
  121. data/spec/unit/pathing_spec.rb +0 -35
  122. data/spec/unit/persistence_spec.rb +0 -115
  123. data/spec/unit/property_predicate_spec.rb +0 -35
  124. data/spec/unit/property_spec.rb +0 -25
  125. data/spec/unit/query_result_builder_spec.rb +0 -31
  126. data/spec/unit/query_spec.rb +0 -307
  127. data/spec/unit/querying_spec.rb +0 -24
  128. data/spec/unit/rdf/indexing_service_spec.rb +0 -114
  129. data/spec/unit/rdf_vocab_spec.rb +0 -30
  130. data/spec/unit/readonly_spec.rb +0 -24
  131. data/spec/unit/reflection_spec.rb +0 -42
  132. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +0 -37
  133. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +0 -38
  134. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +0 -38
  135. data/spec/unit/schema_indexing_strategy_spec.rb +0 -68
  136. data/spec/unit/scoping_spec.rb +0 -67
  137. data/spec/unit/serializers_spec.rb +0 -19
  138. data/spec/unit/solr_config_options_spec.rb +0 -57
  139. data/spec/unit/solr_hit_spec.rb +0 -57
  140. data/spec/unit/solr_query_builder_spec.rb +0 -18
  141. data/spec/unit/solr_service_spec.rb +0 -165
  142. data/spec/unit/sparql_insert_spec.rb +0 -31
  143. data/spec/unit/validations_spec.rb +0 -92
  144. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +0 -29
  145. data/spec/unit/with_metadata/metadata_node_spec.rb +0 -69
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveFedora::FilePathBuilder do
4
- describe ".build" do
5
- subject { described_class.build(parent, nil, 'FOO') }
6
- let(:parent) { ActiveFedora::Base.new(id: '1234') }
7
-
8
- it { is_expected.to eq 'FOO1' }
9
-
10
- context "when some datastreams exist" do
11
- before do
12
- allow(parent).to receive(:attached_files).and_return('FOO56' => instance_double(ActiveFedora::File))
13
- end
14
-
15
- it { is_expected.to eq 'FOO57' }
16
- end
17
- end
18
- end
@@ -1,472 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveFedora::File do
4
- subject(:af_file) { described_class.new }
5
-
6
- it { is_expected.not_to be_metadata }
7
-
8
- describe "#save!" do
9
- context "when updating metadata" do
10
- before do
11
- af_file.content = 'foo'
12
- af_file.save!
13
- af_file.mime_type = 'application/pdf'
14
- end
15
-
16
- it "Updates metadata" do
17
- expect(af_file.metadata).to receive(:save)
18
- af_file.save!
19
- end
20
- end
21
- end
22
-
23
- describe "#behaves_like_io?" do
24
- subject { af_file.send(:behaves_like_io?, object) }
25
-
26
- context "with a File" do
27
- let(:object) { File.new __FILE__ }
28
- it { is_expected.to be true }
29
- end
30
-
31
- context "with a Tempfile" do
32
- after { object.close; object.unlink }
33
- let(:object) { Tempfile.new('foo') }
34
- it { is_expected.to be true }
35
- end
36
-
37
- context "with a StringIO" do
38
- let(:object) { StringIO.new('foo') }
39
- it { is_expected.to be true }
40
- end
41
- end
42
-
43
- describe "#uri" do
44
- subject(:uri) { af_file.uri }
45
-
46
- context "when the file is in an ldp:BasicContainer" do
47
- let(:parent) { ActiveFedora::Base.new(id: '1234') }
48
-
49
- context "and it's initialized with the URI" do
50
- let(:af_file) { described_class.new(parent.uri + "/FOO1") }
51
- it "works" do
52
- expect(uri.to_s).to eq "#{ActiveFedora.fedora.base_uri}/1234/FOO1"
53
- end
54
- end
55
-
56
- context "and it's initialized with an ID" do
57
- let(:af_file) { described_class.new(parent.id + "/FOO1") }
58
- it "works" do
59
- expect(uri.to_s).to eq "#{ActiveFedora.fedora.base_uri}/1234/FOO1"
60
- end
61
- end
62
- end
63
-
64
- context "when the file doesn't have a uri" do
65
- it { is_expected.to eq ::RDF::URI(nil) }
66
- end
67
- end
68
-
69
- context "content" do
70
- let(:mock_conn) do
71
- Faraday.new do |builder|
72
- builder.adapter :test, conn_stubs do |_stub|
73
- end
74
- end
75
- end
76
-
77
- let(:mock_client) do
78
- Ldp::Client.new mock_conn
79
- end
80
-
81
- let(:conn_stubs) do
82
- Faraday::Adapter::Test::Stubs.new do |stub|
83
- stub.head(path) { [200, { 'Content-Length' => '9999' }] }
84
- end
85
- end
86
-
87
- let(:path) { '/fedora/rest/test/1234/abcd' }
88
-
89
- let(:ldp_source) { Ldp::Resource.new(mock_client, path) }
90
-
91
- before do
92
- allow(af_file).to receive(:ldp_source).and_return(ldp_source)
93
- end
94
-
95
- describe '#persisted_size' do
96
- it 'loads the file size attribute from the fedora repository' do
97
- expect(af_file.size).to eq 9999
98
- end
99
-
100
- it 'returns nil without making a head request to Ldp::Resource::BinarySource if it is a new record' do
101
- allow(af_file).to receive(:new_record?).and_return(true)
102
- expect(af_file.ldp_source).not_to receive(:head)
103
- expect(af_file.persisted_size).to eq nil
104
- end
105
- end
106
-
107
- describe '#dirty_size' do
108
- context 'when content has changed from what is currently persisted' do
109
- context 'and has been set to something that has a #size method (i.e. string or File)' do
110
- it 'returns the size of the dirty content' do
111
- dirty_content = instance_double(::File)
112
- allow(dirty_content).to receive(:size) { 8_675_309 }
113
- af_file.content = dirty_content
114
- expect(af_file.size).to eq dirty_content.size
115
- end
116
- end
117
- end
118
-
119
- context 'when content has not changed from what is currently persisted' do
120
- it 'returns nil, indicating that the content is not "dirty", but its not necessarily 0 either.' do
121
- expect(af_file.dirty_size).to be_nil
122
- end
123
- end
124
- end
125
-
126
- describe '#size' do
127
- context 'when content has not changed' do
128
- it 'returns the value of .persisted_size' do
129
- expect(af_file.size).to eq af_file.persisted_size
130
- end
131
- end
132
-
133
- context 'when content has changed' do
134
- it 'returns the value of .dirty_size' do
135
- af_file.content = "i have changed!"
136
- expect(af_file.size).to eq af_file.dirty_size
137
- end
138
- end
139
-
140
- it 'returns nil when #persisted_size and #dirty_size return nil' do
141
- allow(af_file).to receive(:persisted_size) { nil }
142
- allow(af_file).to receive(:dirty_size) { nil }
143
- expect(af_file.size).to be_nil
144
- end
145
- end
146
-
147
- describe ".empty?" do
148
- it "does not be empty" do
149
- expect(af_file.empty?).to be false
150
- end
151
- end
152
-
153
- describe ".has_content?" do
154
- context "when there's content" do
155
- before do
156
- allow(af_file).to receive(:size).and_return(10)
157
- end
158
- it "returns true" do
159
- expect(af_file.has_content?).to be true
160
- end
161
- end
162
-
163
- context "when size is nil" do
164
- before do
165
- allow(af_file).to receive(:size).and_return(nil)
166
- end
167
- it "does not have content" do
168
- expect(af_file).to_not have_content
169
- end
170
- end
171
-
172
- context "when content is zero" do
173
- before do
174
- allow(af_file).to receive(:size).and_return(0)
175
- end
176
- it "returns false" do
177
- expect(af_file.has_content?).to be false
178
- end
179
- end
180
- end
181
- end
182
-
183
- context "when the file has local content" do
184
- before do
185
- af_file.uri = "http://localhost:8983/fedora/rest/test/1234/abcd"
186
- af_file.content = "hi there"
187
- end
188
-
189
- describe "#inspect" do
190
- subject { af_file.inspect }
191
- it { is_expected.to eq "#<ActiveFedora::File uri=\"http://localhost:8983/fedora/rest/test/1234/abcd\" >" }
192
- end
193
- end
194
-
195
- describe "#mime_type" do
196
- let(:parent) { ActiveFedora::Base.create }
197
- before do
198
- parent.add_file('banana', path: 'apple', mime_type: 'video/webm')
199
- parent.save!
200
- end
201
- it "persists" do
202
- expect(parent.reload.apple.mime_type).to eq "video/webm"
203
- end
204
- it "can be updated" do
205
- parent.reload
206
- parent.apple.mime_type = "text/awesome"
207
- expect(parent.apple.mime_type).to eq "text/awesome"
208
- parent.save
209
-
210
- expect(parent.reload.apple.mime_type).to eq "text/awesome"
211
- end
212
- end
213
-
214
- context "original_name" do
215
- subject { af_file.original_name }
216
-
217
- context "on a new file" do
218
- context "that has a name set locally" do
219
- before { af_file.original_name = "my_image.png" }
220
- it { is_expected.to eq "my_image.png" }
221
- end
222
-
223
- context "that doesn't have a name set locally" do
224
- it { is_expected.to be_nil }
225
- end
226
- end
227
-
228
- context "when it's saved" do
229
- let(:parent) { ActiveFedora::Base.create }
230
- before do
231
- parent.add_file('one1two2threfour', path: 'abcd', mime_type: 'video/webm', original_name: 'my image.png')
232
- parent.save!
233
- end
234
-
235
- it "has original_name" do
236
- expect(parent.reload.abcd.original_name).to eq 'my image.png'
237
- end
238
- end
239
-
240
- context "with special characters" do
241
- let(:parent) { ActiveFedora::Base.create }
242
- before do
243
- parent.add_file('one1two2threfour', path: 'abcd', mime_type: 'video/webm', original_name: 'my "image".png')
244
- parent.save!
245
- end
246
- it "saves OK and preserve name" do
247
- expect(parent.reload.abcd.original_name).to eq 'my "image".png'
248
- end
249
- end
250
- end
251
-
252
- context "digest" do
253
- subject(:digest) { af_file.digest }
254
-
255
- context "on a new file" do
256
- it { is_expected.to be_empty }
257
- end
258
-
259
- context "when it's saved" do
260
- let(:parent) { ActiveFedora::Base.create }
261
- before do
262
- parent.add_file('one1two2threfour', path: 'abcd', mime_type: 'video/webm')
263
- parent.save!
264
- end
265
-
266
- it "has digest" do
267
- expect(parent.reload.abcd.digest.first).to be_kind_of RDF::URI
268
- end
269
- end
270
- context "with pre-4.3.0 predicate" do
271
- before do
272
- predicate = ::RDF::URI("http://fedora.info/definitions/v4/repository#digest")
273
- object = RDF::URI.new("urn:sha1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15")
274
- graph = ActiveTriples::Resource.new
275
- graph << RDF::Statement.new(af_file.uri, predicate, object)
276
- allow(af_file).to receive_message_chain(:metadata, :ldp_source, :graph).and_return(graph)
277
- end
278
- it "falls back on fedora:digest if premis:hasMessageDigest is not present" do
279
- expect(digest.first).to be_kind_of RDF::URI
280
- end
281
- end
282
- end
283
-
284
- describe "#checksum" do
285
- let(:digest) { RDF::URI.new("urn:sha1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15") }
286
- before do
287
- allow(af_file).to receive(:digest) { [digest] }
288
- end
289
- its(:checksum) { is_expected.to be_a(ActiveFedora::Checksum) }
290
- it "has the right value" do
291
- expect(af_file.checksum.value).to eq("f1d2d2f924e986ac86fdf7b36c94bcdf32beec15")
292
- end
293
- it "has the right algorithm" do
294
- expect(af_file.checksum.algorithm).to eq("SHA1")
295
- end
296
- end
297
-
298
- describe "#save" do
299
- let(:file) { described_class.new }
300
- context "when there is nothing to save" do
301
- it "does not write" do
302
- expect(file.ldp_source).not_to receive(:create)
303
- expect(file.save).to be false
304
- end
305
- end
306
- end
307
-
308
- describe "#create_date" do
309
- subject { af_file.create_date }
310
- describe "when new record" do
311
- it { is_expected.to be_nil }
312
- end
313
- describe "when persisted" do
314
- before do
315
- af_file.content = "foo"
316
- af_file.save!
317
- end
318
- it { is_expected.to be_a(DateTime) }
319
- end
320
- end
321
-
322
- describe "#modified_date" do
323
- subject { af_file.modified_date }
324
- describe "when new record" do
325
- it { is_expected.to be_nil }
326
- end
327
- describe "when persisted" do
328
- before do
329
- af_file.content = "foo"
330
- af_file.save!
331
- end
332
- it { is_expected.to be_a(DateTime) }
333
- end
334
- end
335
-
336
- describe "callbacks" do
337
- before do
338
- class MyFile < ActiveFedora::File
339
- after_initialize :a_init
340
- before_create :b_create
341
- after_create :a_create
342
- before_update :b_update
343
- after_update :a_update
344
- before_save :b_save
345
- after_save :a_save
346
- before_destroy :b_destroy
347
- after_destroy :a_destroy
348
-
349
- def a_init; end
350
-
351
- def b_create; end
352
-
353
- def a_create; end
354
-
355
- def b_save; end
356
-
357
- def a_save; end
358
-
359
- def b_destroy; end
360
-
361
- def a_destroy; end
362
-
363
- def b_update; end
364
-
365
- def a_update; end
366
- end
367
- end
368
-
369
- after do
370
- Object.send(:remove_const, :MyFile)
371
- end
372
-
373
- subject(:my_file) { MyFile.new }
374
-
375
- describe "initialize" do
376
- specify {
377
- expect_any_instance_of(MyFile).to receive(:a_init)
378
- MyFile.new
379
- }
380
- end
381
-
382
- describe "create" do
383
- describe "when content is not nil" do
384
- specify {
385
- expect(my_file).to receive(:b_create).once
386
- expect(my_file).to receive(:a_create).once
387
- expect(my_file).to receive(:b_save).once
388
- expect(my_file).to receive(:a_save).once
389
- my_file.content = "foo"
390
- my_file.save
391
- }
392
- end
393
- describe "when content is nil" do
394
- specify {
395
- expect(my_file).to receive(:b_create).once
396
- expect(my_file).not_to receive(:a_create)
397
- expect(my_file).to receive(:b_save).once
398
- expect(my_file).not_to receive(:a_save)
399
- my_file.save
400
- }
401
- end
402
- end
403
-
404
- describe "update" do
405
- describe "when content has changed" do
406
- specify {
407
- my_file.content = "foo"
408
- my_file.save
409
- expect(my_file).to receive(:b_save).once
410
- expect(my_file).to receive(:a_save).once
411
- expect(my_file).to receive(:b_update).once
412
- expect(my_file).to receive(:a_update).once
413
- my_file.content = "bar"
414
- my_file.save
415
- }
416
- end
417
- describe "when content has not changed" do
418
- specify {
419
- my_file.content = "foo"
420
- my_file.save
421
- expect(my_file).to receive(:b_save).once
422
- expect(my_file).to receive(:a_save)
423
- expect(my_file).to receive(:b_update).once
424
- expect(my_file).to receive(:a_update)
425
- my_file.save
426
- }
427
- end
428
- end
429
-
430
- describe "destroy" do
431
- specify {
432
- my_file.content = "foo"
433
- my_file.save
434
- expect(my_file).to receive(:b_destroy).once
435
- expect(my_file).to receive(:a_destroy).once
436
- my_file.destroy
437
- }
438
- end
439
- end
440
-
441
- describe "#new" do
442
- let(:file2) do
443
- described_class.new do |file|
444
- file.content = "My Content"
445
- file.save!
446
- end
447
- end
448
-
449
- context "when uri is passed to new" do
450
- subject { described_class.new(file2.uri).content }
451
-
452
- it { is_expected.to eq "My Content" }
453
- end
454
-
455
- context "when id is passed to new" do
456
- subject { described_class.new(file2.id).content }
457
-
458
- it { is_expected.to eq "My Content" }
459
- end
460
-
461
- context "when object responding to .uri is passed to new" do
462
- subject { described_class.new(file2).content }
463
- it { is_expected.to eq "My Content" }
464
- end
465
-
466
- context "when Array passed to new" do
467
- it "raises an expection" do
468
- expect { described_class.new([]) }.to raise_error(RuntimeError)
469
- end
470
- end
471
- end
472
- end