Skip to content

Commit 6287c10

Browse files
committed
Don't report broken absolute path when app_root is nil
When running tests that does not initialize rails (e.g. `rake test` under active_model), it used to just cut off the leading "/" from absolte paths and report something like rails test Users/a_matsuda/rails/activemodel/test/cases/api_test.rb:40 that cannot be executed.
1 parent f517eef commit 6287c10

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

railties/lib/rails/test_unit/reporter.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ def filtered_results
5252
end
5353

5454
def relative_path_for(file)
55-
file.sub(/^#{app_root}\/?/, "")
55+
if app_root
56+
file.sub(/^#{app_root}\/?/, "")
57+
else
58+
file
59+
end
5660
end
5761

5862
private

0 commit comments

Comments
 (0)