aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-12-07 15:16:18 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-12-10 16:08:37 +0900
commite4e42d0b346065f1fce6caaea669c3e4bc42dfc8 (patch)
tree66e99342a40795b2e5fd9a94b56ab44f549f2789 /railties/lib/rails
parent11fbcf84ac29d6040be1b0988d22054342ed74d4 (diff)
downloadrails-e4e42d0b346065f1fce6caaea669c3e4bc42dfc8.tar.gz
rails-e4e42d0b346065f1fce6caaea669c3e4bc42dfc8.tar.bz2
rails-e4e42d0b346065f1fce6caaea669c3e4bc42dfc8.zip
show relative path the rerun snippet of test runner in rails engine
Since the absolute path is not required to re-run the test, modified so that unnecessary information is not displayed. ```ruby # before bin/rails test /path/to/blorgh/test/integration/navigation_test.rb:5 # after bin/rails test test/integration/navigation_test.rb:5 ```
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/test_unit/reporter.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb
index de4b002e55..00ea32d1b8 100644
--- a/railties/lib/rails/test_unit/reporter.rb
+++ b/railties/lib/rails/test_unit/reporter.rb
@@ -44,7 +44,7 @@ module Rails
end
def relative_path_for(file)
- file.sub(/^#{Rails.root}\/?/, '')
+ file.sub(/^#{app_root}\/?/, '')
end
private
@@ -66,5 +66,9 @@ module Rails
"#{self.executable} #{relative_path_for(assertion_path)}"
end
+
+ def app_root
+ @app_root ||= defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root
+ end
end
end