Skip to content

Commit 40d13f6

Browse files
committed
WIP
1 parent c9fda4a commit 40d13f6

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

spec/support/prosopite.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
"shoulda/matchers/active_model/validate_inclusion_of_matcher.rb",
1111
]
1212

13-
PROSOPITE_PATHS = [
14-
"./spec/models/*"
15-
].freeze
13+
PROSOPITE_IGNORE = File.read(".prosopite_ignore").lines.map(&:chomp)
1614

1715
# Monkey-patch FactoryBot to pause Prosopite during factory creation
1816
# This prevents N+1 detection in factory callbacks, focusing on actual test code
@@ -36,21 +34,19 @@ def result(evaluation)
3634

3735
RSpec.configure do |config|
3836
config.around do |example|
39-
should_enable = PROSOPITE_PATHS.any? { |pattern|
40-
File.fnmatch?(pattern, example.metadata[:rerun_file_path]
41-
)
37+
should_ignore = PROSOPITE_IGNORE.any? { |path|
38+
File.fnmatch?("./#{path}/*", example.metadata[:rerun_file_path])
4239
}
43-
44-
if should_enable && !example.metadata[:disable_prosopite]
45-
Prosopite.scan do
46-
example.run
47-
end
48-
else
40+
if should_ignore || example.metadata[:disable_prosopite]
4941
# Disable prosopite globally for this test (works across threads)
5042
original_enabled = Prosopite.enabled?
5143
Prosopite.enabled = false
5244
example.run
5345
Prosopite.enabled = original_enabled
46+
else
47+
Prosopite.scan do
48+
example.run
49+
end
5450
end
5551
end
5652
end

0 commit comments

Comments
 (0)