From 948871236548c4bd278b9430d87812c27277c618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20H=C3=A4usele?= Date: Mon, 11 May 2020 02:22:49 +0200 Subject: [PATCH] Adds a rails test:all rake task (#39221) * Adds a rails test:all rake task This task runs all tests, including system tests. * Better placement + slight tweak of the comment Co-authored-by: David Heinemeier Hansson --- guides/source/testing.md | 1 + railties/CHANGELOG.md | 6 ++++++ railties/lib/rails/test_unit/testing.rake | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/guides/source/testing.md b/guides/source/testing.md index 1187b6c183..0ebf8ca6c4 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -857,6 +857,7 @@ bin/rails test:system NOTE: By default, running `bin/rails test` won't run your system tests. Make sure to run `bin/rails test:system` to actually run them. +You can also run `bin/rails test:all` to run all tests, including system tests. #### Creating Articles System Test diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 2d626a0528..9245c3c84e 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,9 @@ +* Adds `rails test:all` for running all tests in the test directory. + + This runs all test files in the test directory, including system tests. + + *Niklas Häusele* + * Add `config.generators.after_generate` for processing to generated files. Register a callback that will get called right after generators has finished. diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 3a1b62d9d1..c8f118ea55 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -35,6 +35,12 @@ namespace :test do end end + desc "Runs all tests, including system tests" + task all: "test:prepare" do + $: << "test" + Rails::TestUnit::Runner.rake_run(["test/**/*_test.rb"]) + end + task generators: "test:prepare" do $: << "test" Rails::TestUnit::Runner.rake_run(["test/lib/generators"])