Skip to content

Commit 1d50a37

Browse files
ricardotk002leequarella
authored andcommitted
Don't override ActiveSupport::TestCase.test_order
Seemingly some test suites depend on this Updated tests to verify the change to the parallelization flag instead
1 parent 65f3501 commit 1d50a37

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

railties/test/application/test_runner_test.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -547,25 +547,25 @@ def test_parallel_is_disabled_when_single_file_is_run
547547
548548
class ParallelTest < ActiveSupport::TestCase
549549
def test_verify_test_order
550-
puts "Test order: \#{self.class.test_order}"
550+
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
551551
end
552552
end
553553
RUBY
554554

555555
output = run_test_command(file_name)
556556

557-
assert_match "Test order: random", output
557+
assert_match "Test parallelization disabled: true", output
558558
end
559559

560-
def test_random_order_is_enabled_when_multiple_files_are_run
560+
def test_parallel_is_enabled_when_multiple_files_are_run
561561
exercise_parallelization_regardless_of_machine_core_count(with: :processes, force: false)
562562

563563
file_1 = app_file "test/unit/parallel_test_first.rb", <<-RUBY
564564
require "test_helper"
565565
566566
class ParallelTestFirst < ActiveSupport::TestCase
567567
def test_verify_test_order
568-
puts "Test order (file 1): \#{self.class.test_order}"
568+
puts "Test parallelization disabled (file 1): \#{ActiveSupport.test_parallelization_disabled}"
569569
end
570570
end
571571
RUBY
@@ -575,18 +575,18 @@ def test_verify_test_order
575575
576576
class ParallelTestSecond < ActiveSupport::TestCase
577577
def test_verify_test_order
578-
puts "Test order (file 2): \#{self.class.test_order}"
578+
puts "Test parallelization disabled (file 2): \#{ActiveSupport.test_parallelization_disabled}"
579579
end
580580
end
581581
RUBY
582582

583583
output = run_test_command([file_1, file_2].join(" "))
584584

585-
assert_match "Test order (file 1): random", output
586-
assert_match "Test order (file 2): random", output
585+
assert_match "Test parallelization disabled (file 1): false", output
586+
assert_match "Test parallelization disabled (file 2): false", output
587587
end
588588

589-
def test_random_order_is_enabled_when_PARALLEL_WORKERS_is_set
589+
def test_parallel_is_enabled_when_PARALLEL_WORKERS_is_set
590590
@old = ENV["PARALLEL_WORKERS"]
591591
ENV["PARALLEL_WORKERS"] = "5"
592592

@@ -597,14 +597,14 @@ def test_random_order_is_enabled_when_PARALLEL_WORKERS_is_set
597597
598598
class ParallelTest < ActiveSupport::TestCase
599599
def test_verify_test_order
600-
puts "Test order: \#{self.class.test_order}"
600+
puts "Test parallelization disabled: \#{ActiveSupport.test_parallelization_disabled}"
601601
end
602602
end
603603
RUBY
604604

605605
output = run_test_command(file_name)
606606

607-
assert_match "Test order: random", output
607+
assert_match "Test parallelization disabled: false", output
608608
ensure
609609
ENV["PARALLEL_WORKERS"] = @old
610610
end

0 commit comments

Comments
 (0)