Skip to content

Commit f3a4c2f

Browse files
stefan-burketerragon-labs[bot]
andcommitted
test(seed data completeness): clear schema cache in specs to avoid stale data
Clear ActiveRecord schema cache before fetching columns in seed data completeness specs to prevent stale data issues during parallel test runs. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
1 parent 570e50d commit f3a4c2f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec/seeds/assessment_seed_data_completeness_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
# Get all columns from the database schema
2626
let(:db_columns) do
27+
# Clear schema cache to avoid stale data in parallel test runs
28+
ActiveRecord::Base.connection.schema_cache.clear!
2729
ActiveRecord::Base.connection.columns(table_name).map(&:name)
2830
end
2931

@@ -98,6 +100,8 @@
98100
describe "inspection fields" do
99101
let(:seed_fields) { SeedData.inspection_fields(passed: true) }
100102
let(:db_columns) do
103+
# Clear schema cache to avoid stale data in parallel test runs
104+
ActiveRecord::Base.connection.schema_cache.clear!
101105
ActiveRecord::Base.connection.columns("inspections").map(&:name)
102106
end
103107

0 commit comments

Comments
 (0)