Skip to content

Commit 972104e

Browse files
tamsin johnsontamsin johnson
authored andcommitted
rework :with_files factory to work with ActiveFedora/Wings
Fedora builds FileMetadata nodes when files are uploaded, and creating them directly isn't allowed. `Hyrax::ValkyrieUpload` supports the specialized needs of the adapter, so use it to do this step for portability.
1 parent 39a3bef commit 972104e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

spec/factories/hyrax_file_set.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@
6262

6363
trait :with_files do
6464
transient do
65-
files { [valkyrie_create(:hyrax_file_metadata), valkyrie_create(:hyrax_file_metadata)] }
65+
ios { [File.open('spec/fixtures/image.png'), File.open('spec/fixtures/Example.ogg')] }
66+
67+
after(:create) do |file_set, evaluator|
68+
evaluator.ios.each do |file|
69+
filename = File.basename(file.path).to_s
70+
Hyrax::ValkyrieUpload.file(filename: filename, file_set: file_set, io: file)
71+
end
72+
end
6673
end
6774
end
6875

spec/presenters/hyrax/file_set_presenter_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ def uri_segment_escape(uri)
324324
context 'with a file' do
325325
let(:file_set) do
326326
FactoryBot.valkyrie_create(:hyrax_file_set,
327-
:with_files,
328327
files: [file_metadata],
329328
original_file: file_metadata)
330329
end

0 commit comments

Comments
 (0)