From a110ee0982b058cf9f7a9b5ee24a3c193a069b4f Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 13 Oct 2023 08:57:28 +1100 Subject: [PATCH] Simplify Active Storage config for test env --- app/models/report_blob.rb | 10 +--------- config/environments/test.rb | 2 -- config/storage.yml | 6 +----- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/app/models/report_blob.rb b/app/models/report_blob.rb index 050bdbc5e8..b9d3927b68 100644 --- a/app/models/report_blob.rb +++ b/app/models/report_blob.rb @@ -11,7 +11,7 @@ class ReportBlob < ActiveStorage::Blob filename:, content_type: content_type(filename), identify: false, - service_name:, + service_name: :local, ) end @@ -19,14 +19,6 @@ class ReportBlob < ActiveStorage::Blob MIME::Types.of(filename).first&.to_s || "application/octet-stream" end - def self.service_name - if Rails.env.test? - :test - else - :local - end - end - def result @result ||= download.force_encoding(Encoding::UTF_8) end diff --git a/config/environments/test.rb b/config/environments/test.rb index e51d8b19cd..e5cc306c18 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -56,6 +56,4 @@ Openfoodnetwork::Application.configure do config.active_support.deprecation = :stderr config.active_job.queue_adapter = :test - - config.active_storage.service = :test end diff --git a/config/storage.yml b/config/storage.yml index 271782041f..8e0bb583a8 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -1,10 +1,6 @@ local: service: Disk - root: <%= Rails.root.join("storage") %> - -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> + root: <%= Rails.root.join(Rails.env.test? ? "tmp/storage" : "storage") %> test_amazon: service: S3