aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorSiva Gollapalli <siva@joshsoftware.com>2015-12-29 22:57:27 +0530
committerSiva Gollapalli <siva@joshsoftware.com>2016-01-10 22:37:01 +0530
commit78b5a01252bccdb326f94e6fd293f1454596c1f8 (patch)
tree6c6457323756e5749b2bdffbe10c87b1d2486379 /railties/test/application
parent78edeb33346e13ab33a62d2a6b553aabf5b3186a (diff)
downloadrails-78b5a01252bccdb326f94e6fd293f1454596c1f8.tar.gz
rails-78b5a01252bccdb326f94e6fd293f1454596c1f8.tar.bz2
rails-78b5a01252bccdb326f94e6fd293f1454596c1f8.zip
Added multiple line filters support for test runner
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/test_runner_test.rb78
1 files changed, 78 insertions, 0 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb
index 868153762d..ae8a73842c 100644
--- a/railties/test/application/test_runner_test.rb
+++ b/railties/test/application/test_runner_test.rb
@@ -294,6 +294,84 @@ module ApplicationTests
end
end
+ def test_more_than_one_line_filter
+ app_file 'test/models/post_test.rb', <<-RUBY
+ require 'test_helper'
+
+ class PostTest < ActiveSupport::TestCase
+ test "first filter" do
+ puts 'PostTest:FirstFilter'
+ assert true
+ end
+
+ test "second filter" do
+ puts 'PostTest:SecondFilter'
+ assert true
+ end
+
+ test "test line filter does not run this" do
+ assert true
+ end
+ end
+ RUBY
+
+ run_test_command('test/models/post_test.rb:4:9').tap do |output|
+ assert_match 'PostTest:FirstFilter', output
+ assert_match 'PostTest:SecondFilter', output
+ assert_match '2 runs, 2 assertions', output
+ end
+ end
+
+ def test_more_than_one_line_filter_with_multiple_files
+ app_file 'test/models/account_test.rb', <<-RUBY
+ require 'test_helper'
+
+ class AccountTest < ActiveSupport::TestCase
+ test "first filter" do
+ puts 'AccountTest:FirstFilter'
+ assert true
+ end
+
+ test "second filter" do
+ puts 'AccountTest:SecondFilter'
+ assert true
+ end
+
+ test "line filter does not run this" do
+ assert true
+ end
+ end
+ RUBY
+
+ app_file 'test/models/post_test.rb', <<-RUBY
+ require 'test_helper'
+
+ class PostTest < ActiveSupport::TestCase
+ test "first filter" do
+ puts 'PostTest:FirstFilter'
+ assert true
+ end
+
+ test "second filter" do
+ puts 'PostTest:SecondFilter'
+ assert true
+ end
+
+ test "line filter does not run this" do
+ assert true
+ end
+ end
+ RUBY
+
+ run_test_command('test/models/account_test.rb:4:9 test/models/post_test:4:9').tap do |output|
+ assert_match 'AccountTest:FirstFilter', output
+ assert_match 'AccountTest:SecondFilter', output
+ assert_match 'PostTest:FirstFilter', output
+ assert_match 'PostTest:SecondFilter', output
+ assert_match '4 runs, 4 assertions', output
+ end
+ end
+
def test_multiple_line_filters
create_test_file :models, 'account'
create_test_file :models, 'post'