Skip to content

Commit

Permalink
External body spec (#653)
Browse files Browse the repository at this point in the history
* Add spec for enabled external storage

* Add minio to circleci

* Force ext store on and off in spec
  • Loading branch information
dlpierce authored Feb 5, 2025
1 parent 63e8276 commit 9f4dba8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ jobs:
MYSQL_DATABASE: essi_test
MYSQL_USER: essi
MYSQL_PASSWORD: essi
- image: bitnami/minio:latest
environment:
MINIO_ROOT_USER: essi-minio
MINIO_ROOT_PASSWORD: Essi12345
MINIO_DEFAULT_BUCKETS: 'essi-test'

resource_class: medium+
parallelism: 4
Expand Down
24 changes: 21 additions & 3 deletions spec/actors/hyrax/actors/file_actor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,27 @@
.with(:essi, :store_original_files) \
.and_return(true)
end
it 'saves an image file to the member file_set' do
file_actor.ingest_file(io)
expect(file_set.reload.original_file.mime_type).to include "image/png"
context 'when :store_in_external_storage is false' do
before do
allow(ESSI.config).to receive(:dig) \
.with(:essi, :store_in_external_storage) \
.and_return(false)
end
it 'saves an image file to the member file_set' do
file_actor.ingest_file(io)
expect(file_set.reload.original_file.mime_type).to include "image/png"
end
end
context 'when :store_in_external_storage is true' do
before do
allow(ESSI.config).to receive(:dig) \
.with(:essi, :store_in_external_storage) \
.and_return(true)
end
it 'saves an image file to the member file_set as an external file' do
file_actor.ingest_file(io)
expect(file_set.reload.original_file.mime_type).to include "message/external-body;access-type=URL;url="
end
end
context 'when the file_set is for collection branding' do
before do
Expand Down

0 comments on commit 9f4dba8

Please sign in to comment.