1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix failing tests on Active Storage

This commit is contained in:
Gannon McGibbon 2019-10-01 17:01:20 -04:00
parent 84d236d0a9
commit 5d81880670
2 changed files with 4 additions and 2 deletions

View file

@ -6,12 +6,14 @@ require "database/setup"
if SERVICE_CONFIGURATIONS[:s3] && SERVICE_CONFIGURATIONS[:s3][:access_key_id].present? if SERVICE_CONFIGURATIONS[:s3] && SERVICE_CONFIGURATIONS[:s3][:access_key_id].present?
class ActiveStorage::S3DirectUploadsControllerTest < ActionDispatch::IntegrationTest class ActiveStorage::S3DirectUploadsControllerTest < ActionDispatch::IntegrationTest
setup do setup do
Rails.configuration.active_storage.service = "s3"
@old_service = ActiveStorage::Blob.service @old_service = ActiveStorage::Blob.service
ActiveStorage::Blob.service = ActiveStorage::Service.configure(:s3, SERVICE_CONFIGURATIONS) ActiveStorage::Blob.service = ActiveStorage::Service.configure(:s3, SERVICE_CONFIGURATIONS)
end end
teardown do teardown do
ActiveStorage::Blob.service = @old_service ActiveStorage::Blob.service = @old_service
Rails.configuration.active_storage.service = "local"
end end
test "creating new direct upload" do test "creating new direct upload" do

View file

@ -35,13 +35,13 @@ end
require "tmpdir" require "tmpdir"
Rails.configuration.active_storage.service_configurations = { Rails.configuration.active_storage.service_configurations = SERVICE_CONFIGURATIONS.deep_stringify_keys.merge(
"local" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests") }, "local" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests") },
"disk_mirror_1" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_1") }, "disk_mirror_1" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_1") },
"disk_mirror_2" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_2") }, "disk_mirror_2" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_2") },
"disk_mirror_3" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_3") }, "disk_mirror_3" => { "service" => "Disk", "root" => Dir.mktmpdir("active_storage_tests_3") },
"mirror" => { "service" => "Mirror", "primary" => "local", "mirrors" => ["disk_mirror_1", "disk_mirror_2", "disk_mirror_3"] } "mirror" => { "service" => "Mirror", "primary" => "local", "mirrors" => ["disk_mirror_1", "disk_mirror_2", "disk_mirror_3"] }
} )
Rails.configuration.active_storage.service = "local" Rails.configuration.active_storage.service = "local"