lib/rubocop/cop/minitest/test_file_name.rb in rubocop-minitest-0.26.0 vs lib/rubocop/cop/minitest/test_file_name.rb in rubocop-minitest-0.26.1
- old
+ new
@@ -19,10 +19,11 @@
include MinitestExplorationHelpers
MSG = 'Test file path should start with `test_` or end with `_test.rb`.'
def on_new_investigation
- return unless test_file?(processed_source.ast)
+ return unless (ast = processed_source.ast)
+ return unless test_file?(ast)
add_global_offense(MSG) unless valid_file_name?
end
private