aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-04 23:06:33 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-05 21:53:27 +0100
commit84b72a812f9fb488241f06ec573dd751d52f7a67 (patch)
tree839aa365467d45fdb84e080db26cb9eb8c357a1f /railties/test
parentd666a5a5cfd4692cb8ff3914d7ff0e3885c7eb5c (diff)
downloadrails-84b72a812f9fb488241f06ec573dd751d52f7a67.tar.gz
rails-84b72a812f9fb488241f06ec573dd751d52f7a67.tar.bz2
rails-84b72a812f9fb488241f06ec573dd751d52f7a67.zip
Fix mixing line filters with Minitest's -n filter.
Previous commit accidentally broke mixing line filters with string -n filter. Fix by checking if it is a string and returning it. We also need to ensure the -n filter carry forward into any other composite filters. Fix by letting the named filter be extractable, so we'll keep this for the next runnable's run.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/test_runner_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb
index 821ac9b033..7ecadb60ca 100644
--- a/railties/test/application/test_runner_test.rb
+++ b/railties/test/application/test_runner_test.rb
@@ -406,6 +406,30 @@ module ApplicationTests
end
end
+ def test_line_filter_with_minitest_string_filter
+ app_file 'test/models/post_test.rb', <<-RUBY
+ require 'test_helper'
+
+ class PostTest < ActiveSupport::TestCase
+ test 'by line' do
+ puts 'by line'
+ assert true
+ end
+
+ test 'by name' do
+ puts 'by name'
+ assert true
+ end
+ end
+ RUBY
+
+ run_test_command('test/models/post_test.rb:4 -n test_by_name').tap do |output|
+ assert_match 'by line', output
+ assert_match 'by name', output
+ assert_match '2 runs, 2 assertions', output
+ end
+ end
+
def test_shows_filtered_backtrace_by_default
create_backtrace_test