From 2e5960490936890624cdb2e23c9da4f2b12c4fbf Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 13 Jun 2015 11:56:32 +0200 Subject: make it possible to customize the executable inside rereun snippets. In the Rails repository we use a `bin/test` executable to run our tests. However the rerun snippets still included `bin/rails test`: BEFORE: ``` Failed tests: bin/rails test test/cases/adapters/postgresql/schema_test.rb:91 ``` AFTER: ``` Failed tests: bin/test test/cases/adapters/postgresql/schema_test.rb:91 ``` --- railties/test/test_unit/reporter_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test/test_unit/reporter_test.rb') diff --git a/railties/test/test_unit/reporter_test.rb b/railties/test/test_unit/reporter_test.rb index 77883612f5..d619a3e515 100644 --- a/railties/test/test_unit/reporter_test.rb +++ b/railties/test/test_unit/reporter_test.rb @@ -43,6 +43,20 @@ class TestUnitReporterTest < ActiveSupport::TestCase assert_rerun_snippet_count 1 end + test "allows to customize the executable in the rerun snippet" do + original_executable = Rails::TestUnitReporter.executable + begin + Rails::TestUnitReporter.executable = "bin/test" + verbose = Rails::TestUnitReporter.new @output, verbose: true + @reporter.record(failed_test) + @reporter.report + + assert_match %r{^bin/test .*test/test_unit/reporter_test.rb:6$}, @output.string + ensure + Rails::TestUnitReporter.executable = original_executable + end + end + private def assert_rerun_snippet_count(snippet_count) assert_equal snippet_count, @output.string.scan(%r{^bin/rails test }).size -- cgit v1.2.3