Skip to content

Commit

Permalink
parallelize_setup/teardownをそれぞれ追加
Browse files Browse the repository at this point in the history
  • Loading branch information
motohiro-mm committed Aug 4, 2024
1 parent aa56ff7 commit 37d0830
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
ActionMailer::Base.deliveries.clear
end

# parallelize_setup do |i|
# ActiveStorage::Blob.service.instance_variable_set(:@root, "#{ActiveStorage::Blob.service.root}-#{i}")
# end
parallelize_setup do |i|
ActiveStorage::Blob.service.instance_variable_set(:@root, "#{ActiveStorage::Blob.service.root}-#{i}")
end

# def after_teardown
# super
# FileUtils.rm_rf(ActiveStorage::Blob.service.root)
# end
parallelize_teardown do |_|
FileUtils.rm_rf(ActiveStorage::Blob.service.root)
end
end
8 changes: 8 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class ActiveSupport::TestCase
teardown do
ActiveStorage::Current.host = nil
end

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

parallelize_teardown do |_|
FileUtils.rm_rf(ActiveStorage::Blob.services.fetch(:test_fixtures).root)
end
end

class ActionDispatch::IntegrationTest
Expand Down

0 comments on commit 37d0830

Please sign in to comment.