mirror of https://github.com/rails/rails
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.
This commit is contained in:
parent
f517eefe14
commit
6287c109d3
|
@ -52,7 +52,11 @@ module Rails
|
|||
end
|
||||
|
||||
def relative_path_for(file)
|
||||
file.sub(/^#{app_root}\/?/, "")
|
||||
if app_root
|
||||
file.sub(/^#{app_root}\/?/, "")
|
||||
else
|
||||
file
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue