Skip to content

Commit

Permalink
fix: persist with Thread.current
Browse files Browse the repository at this point in the history
Tracks the previous execution group.
- seed or not seed base on flag on current group
- truncate if the previous group seeded
  • Loading branch information
elasticspoon committed Apr 19, 2024
1 parent 3829473 commit bdc2a74
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ def seed_base_data_for_tests
end

config.before(:all) do
unless self.class.metadata[:skip_seed]
seed_base_data_for_tests
define_global_variables
unless Thread.current[:skipped_last_seeding]
DatabaseCleaner.clean_with(:truncation)
end
end

config.after(:all) do
Thread.current[:skipped_last_seeding] = true
unless self.class.metadata[:skip_seed]
DatabaseCleaner.clean_with(:truncation)
seed_base_data_for_tests
define_global_variables
Thread.current[:skipped_last_seeding] = false
end
end

Expand Down

0 comments on commit bdc2a74

Please sign in to comment.