Skip to content

Commit

Permalink
テストが全部終わったらStorageのtmpフォルダを削除するように設定
Browse files Browse the repository at this point in the history
削除しやすくするためにparallelize_setupのフォルダ名の命名も階層を1つ深くした
  • Loading branch information
motohiro-mm committed Aug 5, 2024
1 parent caecf3d commit edfd7df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ class ActiveSupport::TestCase
end

parallelize_setup do |i|
ActiveStorage::Blob.service.instance_variable_set(:@root, "#{ActiveStorage::Blob.service.root}-#{i}")
ActiveStorage::Blob.services.fetch(:test_fixtures).instance_variable_set(:@root, "#{ActiveStorage::Blob.services.fetch(:test_fixtures).root}-#{i}")
ActiveStorage::Blob.service.instance_variable_set(:@root, "#{ActiveStorage::Blob.service.root}/storage-#{i}")
ActiveStorage::Blob.services.fetch(:test_fixtures).instance_variable_set(:@root, "#{ActiveStorage::Blob.services.fetch(:test_fixtures).root}/fixtures-#{i}")
end

Minitest.after_run do
FileUtils.rm_rf(ActiveStorage::Blob.service.root)
FileUtils.rm_rf(ActiveStorage::Blob.services.fetch(:test_fixtures).root)
end
end

Expand Down

0 comments on commit edfd7df

Please sign in to comment.