Skip to content

Commit

Permalink
Allow test command invocations to exit failure
Browse files Browse the repository at this point in the history
Minitest will now exit 1 when a `-n` type test filter is used and no
test cases end up being run. However, these tests are not really
concerned with the exit code, just that `test:prepare` doesn't run.

This commit adds `allow_failure: true` to the test command invocations
so that we can continue to test whether `test:prepare` is run without
caring about the exit status of the test command.
  • Loading branch information
skipkayhil committed May 15, 2024
1 parent f12bbb6 commit 6ec2384
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions railties/test/commands/test_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ class Rails::Command::TestTest < ActiveSupport::TestCase

test "test command with name option skips test:prepare task" do
assert_skips_prepare_task do
run_test_command("test", "-n", "test_some_code")
run_test_command("test", "-n", "test_some_code", allow_failure: true)
end

assert_skips_prepare_task do
run_test_command("test", "-n", "/some_code/")
run_test_command("test", "-n", "/some_code/", allow_failure: true)
end

assert_skips_prepare_task do
run_test_command("test", "-n", "some code")
run_test_command("test", "-n", "some code", allow_failure: true)
end

assert_skips_prepare_task do
run_test_command("test", "--name", "test_some_code")
run_test_command("test", "--name", "test_some_code", allow_failure: true)
end

assert_skips_prepare_task do
run_test_command("test", "--name=test_some_code")
run_test_command("test", "--name=test_some_code", allow_failure: true)
end
end

Expand All @@ -74,7 +74,7 @@ class Rails::Command::TestTest < ActiveSupport::TestCase

test "test:all with name option skips test:prepare task" do
assert_skips_prepare_task do
run_test_command("test:all", "-n", "test_some_code")
run_test_command("test:all", "-n", "test_some_code", allow_failure: true)
end
end

Expand All @@ -86,7 +86,7 @@ class Rails::Command::TestTest < ActiveSupport::TestCase

test "test:* with name option skips test:prepare task" do
assert_skips_prepare_task do
run_test_command("test:models", "-n", "test_some_code")
run_test_command("test:models", "-n", "test_some_code", allow_failure: true)
end
end

Expand Down

0 comments on commit 6ec2384

Please sign in to comment.