diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-12-07 15:16:18 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-12-10 16:08:37 +0900 |
commit | e4e42d0b346065f1fce6caaea669c3e4bc42dfc8 (patch) | |
tree | 66e99342a40795b2e5fd9a94b56ab44f549f2789 /railties/lib/rails/test_unit | |
parent | 11fbcf84ac29d6040be1b0988d22054342ed74d4 (diff) | |
download | rails-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/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/reporter.rb | 6 |
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 |