Skip to content

Commit

Permalink
rework :with_files factory to work with ActiveFedora/Wings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tamsin johnson authored and tamsin johnson committed Oct 26, 2023
1 parent 39a3bef commit 972104e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion spec/factories/hyrax_file_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@

trait :with_files do
transient do
files { [valkyrie_create(:hyrax_file_metadata), valkyrie_create(:hyrax_file_metadata)] }
ios { [File.open('spec/fixtures/image.png'), File.open('spec/fixtures/Example.ogg')] }

after(:create) do |file_set, evaluator|
evaluator.ios.each do |file|
filename = File.basename(file.path).to_s
Hyrax::ValkyrieUpload.file(filename: filename, file_set: file_set, io: file)
end
end
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/presenters/hyrax/file_set_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def uri_segment_escape(uri)
context 'with a file' do
let(:file_set) do
FactoryBot.valkyrie_create(:hyrax_file_set,
:with_files,
files: [file_metadata],
original_file: file_metadata)
end
Expand Down

0 comments on commit 972104e

Please sign in to comment.