File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 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
3735RSpec . 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
5652end
You can’t perform that action at this time.
0 commit comments