diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bf62c281..5a99d211 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,11 +1,5 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base - # This is necessary only for localhost development, with storage configured for the filesystem, - # but it shouldn't cause problems in other environments that use S3. - # Including this concern lets the disk service generate URLs using - # the same host, protocol, and port as the current request. - # include ActiveStorage::SetCurrent - protect_from_forgery with: :exception before_action :authenticate_user! diff --git a/config/environments/development.rb b/config/environments/development.rb index 06176e96..22b2713e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,9 +34,6 @@ config.cache_store = :null_store end - # Store uploaded files on amazon (see config/storage.yml for options). - # config.active_storage.service = :local - config.action_mailer.perform_caching = false config.action_mailer.default_options = { diff --git a/config/environments/production.rb b/config/environments/production.rb index cd647c88..d2ca1850 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -40,9 +40,6 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - # config.active_storage.service = :local - # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' diff --git a/config/environments/staging.rb b/config/environments/staging.rb index cd6bdc9a..9c4abc01 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -40,9 +40,6 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options). - # config.active_storage.service = :local - # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' diff --git a/config/environments/test.rb b/config/environments/test.rb index fc5aaf86..2794c90e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -39,9 +39,6 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory. - # config.active_storage.service = :test - config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. diff --git a/spec/controllers/works_controller_spec.rb b/spec/controllers/works_controller_spec.rb index 4fe8563b..63493e1e 100644 --- a/spec/controllers/works_controller_spec.rb +++ b/spec/controllers/works_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -76,7 +75,6 @@ work.reload expect(work.resource_type).to eq("Dataset") expect(work.resource_type_general).to eq("Dataset") - # expect(ActiveStorage::PurgeJob).not_to have_received(:new) end it "handles the reordering the creators on the update page" do @@ -366,7 +364,6 @@ expect(saved_work.pre_curation_uploads.length).to eq(1) - # expect(ActiveStorage::PurgeJob).not_to have_received(:new) expect(fake_s3_service).to have_received(:delete_s3_object).with(s3_file1.key) expect(fake_s3_service).to have_received(:delete_s3_object).with(s3_file3.key) expect(fake_s3_service).not_to have_received(:delete_s3_object).with(s3_file2.key) @@ -428,7 +425,6 @@ post :update, params: params_no_delete expect(response).to redirect_to(work_path(work)) - # expect(ActiveStorage::PurgeJob).not_to have_received(:new) end end end diff --git a/spec/controllers/works_wizard_controller_spec.rb b/spec/controllers/works_wizard_controller_spec.rb index 9f7db068..bbe008f7 100644 --- a/spec/controllers/works_wizard_controller_spec.rb +++ b/spec/controllers/works_wizard_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -46,7 +45,6 @@ post(:update_wizard, params:) expect(response.status).to be 302 expect(response.location).to eq "http://test.host/works/#{work.id}/update-additional" - # expect(ActiveStorage::PurgeJob).not_to have_received(:new) end context "save and stay on page" do diff --git a/spec/controllers/works_wizard_update_additonal_controller_spec.rb b/spec/controllers/works_wizard_update_additonal_controller_spec.rb index 1505030d..d7650fe7 100644 --- a/spec/controllers/works_wizard_update_additonal_controller_spec.rb +++ b/spec/controllers/works_wizard_update_additonal_controller_spec.rb @@ -9,7 +9,6 @@ Group.create_defaults user stub_datacite(host: "api.datacite.org", body: datacite_register_body(prefix: "10.34770")) - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original stub_request(:get, /#{Regexp.escape('https://example-bucket.s3.amazonaws.com/us_covid_20')}.*\.csv/).to_return(status: 200, body: "", headers: {}) end @@ -45,7 +44,6 @@ patch(:update_additional_save, params:) expect(response.status).to be 302 expect(response.location).to eq "http://test.host/works/#{work.id}/readme-select" - # expect(ActiveStorage::PurgeJob).not_to have_received(:new) end context "save and stay on page" do diff --git a/spec/system/work_edit_spec.rb b/spec/system/work_edit_spec.rb index a4a41248..4d6db829 100644 --- a/spec/system/work_edit_spec.rb +++ b/spec/system/work_edit_spec.rb @@ -43,7 +43,6 @@ end it "allows users to delete one of the uploads" do - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original allow(fake_s3_service).to receive(:client_s3_files).and_return([contents1, contents2], [contents2]) expect(page).to have_content "Filename" @@ -63,7 +62,6 @@ end it "allows users to cancel the delete of one of the uploads" do - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original allow(fake_s3_service).to receive(:client_s3_files).and_return([contents1, contents2], [contents2]) expect(page).to have_link "us_covid_2019.csv" @@ -76,7 +74,6 @@ end it "allows users to replace one of the uploads" do - # allow(ActiveStorage::PurgeJob).to receive(:new).and_call_original expect(page).to have_content "Filename" expect(page).to have_content "Last Modified" expect(page).to have_content "Size"