diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-06-25 19:08:26 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-07-10 20:40:16 +0200 |
commit | 0d72489b2a08487f71dd4230846c01a5d99ef35f (patch) | |
tree | 361e00c0c82de24f359bbe5ba32b76d9913c609e /railties/lib/rails/test_unit/testing.rake | |
parent | b6300f3ecc79bff29cf9bb804a30fd92403feac1 (diff) | |
download | rails-0d72489b2a08487f71dd4230846c01a5d99ef35f.tar.gz rails-0d72489b2a08487f71dd4230846c01a5d99ef35f.tar.bz2 rails-0d72489b2a08487f71dd4230846c01a5d99ef35f.zip |
* Don't eagerly require Rails' minitest plugin.
By making the Rails minitest behave like a standard minitest plugin
we're much more likely to not break when people use other minitest
plugins. Like minitest-focus and pride.
To do this, we need to behave like minitest: require files up front
and then perform the plugin behavior via the at_exit hook.
This also saves us a fair bit of wrangling with test file loading.
Finally, since the environment and warnings options have to be applied
as early as possible, and since minitest loads plugins at_exit, they
have to be moved to the test command.
* Don't expect the root method.
It's likely this worked because we eagerly loaded the Rails minitest plugin
and that somehow defined a root method on `Rails`.
* Assign a backtrace to failed exceptions.
Otherwise Minitest pukes when attempting to filter the backtrace (which
Rails' backtrace cleaner then removes).
Means the exception message test has to be revised too.
This is likely caused by the rails minitest plugin now being loaded for
these tests and assigning a default backtrace cleaner.
Diffstat (limited to 'railties/lib/rails/test_unit/testing.rake')
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 486446b463..97dd5cef10 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -1,6 +1,6 @@ gem "minitest" require "minitest" -require_relative "minitest_plugin" +require_relative "runner" task default: :test @@ -9,9 +9,9 @@ task :test do $: << "test" if ENV.key?("TEST") - Minitest.rake_run([ENV["TEST"]]) + Rails::TestUnit::Runner.rake_run([ENV["TEST"]]) else - Minitest.rake_run(["test"], ["test/system/**/*"]) + Rails::TestUnit::Runner.rake_run end end @@ -29,28 +29,28 @@ namespace :test do ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name| task name => "test:prepare" do $: << "test" - Minitest.rake_run(["test/#{name}"]) + Rails::TestUnit::Runner.rake_run(["test/#{name}"]) end end task generators: "test:prepare" do $: << "test" - Minitest.rake_run(["test/lib/generators"]) + Rails::TestUnit::Runner.rake_run(["test/lib/generators"]) end task units: "test:prepare" do $: << "test" - Minitest.rake_run(["test/models", "test/helpers", "test/unit"]) + Rails::TestUnit::Runner.rake_run(["test/models", "test/helpers", "test/unit"]) end task functionals: "test:prepare" do $: << "test" - Minitest.rake_run(["test/controllers", "test/mailers", "test/functional"]) + Rails::TestUnit::Runner.rake_run(["test/controllers", "test/mailers", "test/functional"]) end desc "Run system tests only" task system: "test:prepare" do $: << "test" - Minitest.rake_run(["test/system"]) + Rails::TestUnit::Runner.rake_run(["test/system"]) end end |