diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-01-18 21:37:12 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-01-18 21:37:12 +0100 |
commit | 88881d2b50b5d89fc30c77c2e1669b858bbf418a (patch) | |
tree | 6ce6c2f6dffb10630500a09a7342c10d262cf133 /railties | |
parent | 426b3127dd60e874a463ea022c85bc3eaf6ea4b3 (diff) | |
download | rails-88881d2b50b5d89fc30c77c2e1669b858bbf418a.tar.gz rails-88881d2b50b5d89fc30c77c2e1669b858bbf418a.tar.bz2 rails-88881d2b50b5d89fc30c77c2e1669b858bbf418a.zip |
Don't run all tests when files end in a colon.
If running `bin/rails t test/models/bunny_test.rb:` we'd implicitly run all the
tests in the bunny test. I now highly doubt that people would ever put in a line
filter without a line *and* want that to mean run all tests in that file.
Instead, change regex to require a line digit after the colon, so runs without a
line at the end would fail to require the test file.
This also has the side benefit of breaking requiring a file with many colons:
`bin/rails t test/models/bunny_test.rb:::::::::::::4`
Think this means I've had enough colonoscopy to last me through the year :)
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/test_unit/test_requirer.rb | 2 | ||||
-rw-r--r-- | railties/test/application/test_runner_test.rb | 8 |
2 files changed, 1 insertions, 9 deletions
diff --git a/railties/lib/rails/test_unit/test_requirer.rb b/railties/lib/rails/test_unit/test_requirer.rb index 8b9933bed4..8b211ce130 100644 --- a/railties/lib/rails/test_unit/test_requirer.rb +++ b/railties/lib/rails/test_unit/test_requirer.rb @@ -15,7 +15,7 @@ module Rails private def expand_patterns(patterns) patterns.map do |arg| - arg = arg.gsub(/(:\d*)+?$/, '') + arg = arg.gsub(/(:\d+)+?$/, '') if Dir.exist?(arg) "#{arg}/**/*_test.rb" else diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index bb6c6574c5..0745abf381 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -382,14 +382,6 @@ module ApplicationTests end end - def test_line_filter_without_line_runs_all_tests - create_test_file :models, 'account' - - run_test_command('test/models/account_test.rb:').tap do |output| - assert_match 'AccountTest', output - end - end - def test_shows_filtered_backtrace_by_default create_backtrace_test |