Skip to content

Commit

Permalink
Updated test for Show page to account for files uploaded via ActiveSt…
Browse files Browse the repository at this point in the history
…orage
  • Loading branch information
hectorcorrea committed Aug 15, 2022
1 parent 4483308 commit ae5acd2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/system/view_data_in_s3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@
end
let(:s3_data) { [file1, file2] }

let(:bucket_url) do
"https://example-bucket.s3.amazonaws.com/"
end

before do
# Account for files in S3 added outside of ActiveStorage
allow(S3QueryService).to receive(:new).and_return(s3_query_service_double)
allow(s3_query_service_double).to receive(:data_profile).and_return({ objects: s3_data, ok: true })

# Account for files uploaded to S3 via ActiveStorage
stub_request(:put, /#{bucket_url}/).to_return(status: 200)
file = fixture_file_upload("us_covid_2019.csv", "text/csv")
work.deposit_uploads.attach(file)
end

it "shows data from S3", js: true do
Expand Down

0 comments on commit ae5acd2

Please sign in to comment.