diff --git a/spec/controllers/works_controller_spec.rb b/spec/controllers/works_controller_spec.rb index edaa75f9a..c9e7a689e 100644 --- a/spec/controllers/works_controller_spec.rb +++ b/spec/controllers/works_controller_spec.rb @@ -184,7 +184,7 @@ background_snapshot = BackgroundUploadSnapshot.last expect(background_snapshot.work).to eq(work) expect(background_snapshot.files.map { |file| file["user_id"] }.uniq).to eq([user.id]) - expect(background_snapshot.files.first["filename"]).to eq "10.34770/123-abc/1us_covid_2019.csv" + expect(background_snapshot.files.first["filename"]).to eq "10.34770/123-abc/1/us_covid_2019.csv" expect(background_snapshot.files.first["upload_status"]).to eq "complete" end end @@ -245,9 +245,9 @@ expect(background_snapshot.work).to eq(work) expect(background_snapshot.files.map { |file| file["user_id"] }.uniq).to eq([user.id]) - file1 = background_snapshot.files.find { |file| file["filename"] == "10.34770/123-abc/1us_covid_2019.csv" } + file1 = background_snapshot.files.find { |file| file["filename"] == "10.34770/123-abc/1/us_covid_2019.csv" } expect(file1["upload_status"]).to eq "complete" - file2 = background_snapshot.files.find { |file| file["filename"] == "10.34770/123-abc/1us_covid_2020.csv" } + file2 = background_snapshot.files.find { |file| file["filename"] == "10.34770/123-abc/1/us_covid_2020.csv" } expect(file2["upload_status"]).to eq "complete" end end diff --git a/spec/requests/works_spec.rb b/spec/requests/works_spec.rb index 8a0704334..c30ac44b5 100644 --- a/spec/requests/works_spec.rb +++ b/spec/requests/works_spec.rb @@ -174,9 +174,9 @@ background_snapshot = BackgroundUploadSnapshot.last expect(background_snapshot.work).to eq(work) expect(background_snapshot.files.map { |file| file["user_id"] }.uniq).to eq([user.id]) - expect(background_snapshot.files.first["filename"]).to eq "10.34770/123-abc/1us_covid_2019.csv" + expect(background_snapshot.files.first["filename"]).to eq "10.34770/123-abc/1/us_covid_2019.csv" expect(background_snapshot.files.first["upload_status"]).to eq "complete" - expect(background_snapshot.files.second["filename"]).to eq "10.34770/123-abc/1us_covid_2020.csv" + expect(background_snapshot.files.second["filename"]).to eq "10.34770/123-abc/1/us_covid_2020.csv" expect(background_snapshot.files.second["upload_status"]).to eq "complete" end end diff --git a/spec/services/work_preservation_service_spec.rb b/spec/services/work_preservation_service_spec.rb index 1123c88a9..353149308 100644 --- a/spec/services/work_preservation_service_spec.rb +++ b/spec/services/work_preservation_service_spec.rb @@ -5,7 +5,7 @@ describe "preserve in S3" do let(:approved_work) { FactoryBot.create :approved_work, doi: "10.34770/pe9w-x904" } let(:path) { approved_work.s3_query_service.prefix } - let(:preservation_directory) { path + "/princeton_data_commons/" } + let(:preservation_directory) { path + "princeton_data_commons/" } let(:file1) { FactoryBot.build :s3_file, filename: "#{approved_work.doi}/#{approved_work.id}/anyfile1.txt", last_modified: Time.parse("2022-04-21T18:29:40.000Z") } let(:file2) { FactoryBot.build :s3_file, filename: "#{approved_work.doi}/#{approved_work.id}/folder1/anyfile2.txt", last_modified: Time.parse("2022-04-21T18:29:40.000Z") } let(:preservation_file1) do @@ -48,7 +48,7 @@ subject = described_class.new(work_id: approved_work.id, path: local_path, localhost: true) location = subject.preserve! expect(location.start_with?("file:///")).to be true - expect(location.end_with?("#{local_path}/princeton_data_commons/")).to be true + expect(location.end_with?("#{local_path}princeton_data_commons/")).to be true end end end diff --git a/spec/support/s3_query_service_specs.rb b/spec/support/s3_query_service_specs.rb index 79a232cd7..96c56b3ef 100644 --- a/spec/support/s3_query_service_specs.rb +++ b/spec/support/s3_query_service_specs.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -def stub_s3(data: [], bucket_url: nil, prefix: "10.34770/123-abc/1", bucket_name: "example-bucket") +def stub_s3(data: [], bucket_url: nil, prefix: "10.34770/123-abc/1/", bucket_name: "example-bucket") @s3_client = instance_double(Aws::S3::Client) allow(@s3_client).to receive(:head_object) allow(@s3_client).to receive(:delete_object)