From d36742e57aeca495f0b88604b92a11c3841be670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Reeves?= Date: Wed, 4 May 2022 16:49:15 +0200 Subject: [PATCH] Remove disable_autorun (#30) * Remove disable_autorun * Update changelog * Remove scenarios that were only testing the disable_autorun feature Co-authored-by: Aurelien Reeves Co-authored-by: Matt Wynne --- CHANGELOG.md | 6 +++++ lib/multi_test.rb | 27 ------------------- test/gemfiles/activesupport-4/scenarios | 1 - test/gemfiles/activesupport-5/scenarios | 1 - test/gemfiles/minitest-4/scenarios | 2 -- test/gemfiles/minitest-5/scenarios | 2 -- test/gemfiles/plain-ruby/scenarios | 1 - test/gemfiles/rspec-1/scenarios | 1 - test/gemfiles/rspec-2/scenarios | 1 - test/gemfiles/rspec-3/scenarios | 1 - test/gemfiles/test-unit-2/scenarios | 2 -- test/gemfiles/test-unit-3/scenarios | 2 -- test/scenarios/bundler_require.rb | 7 ----- .../scenarios/minitest_propagate_exit_code.rb | 9 ------- .../require_activesupport_testing_autorun.rb | 4 --- test/scenarios/require_test_unit.rb | 6 ----- 16 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 test/scenarios/bundler_require.rb delete mode 100644 test/scenarios/minitest_propagate_exit_code.rb delete mode 100644 test/scenarios/require_activesupport_testing_autorun.rb delete mode 100644 test/scenarios/require_test_unit.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index c54c660..080ff90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO * Drop support for ruby < 2.0 ([PR#28](https://github.com/cucumber/multi_test/pull/28)) +### Removed + +* Removed `disable_autorun` + ([PR#30](https://github.com/cucumber/multi_test/pull/30) + [Issue#26](https://github.com/cucumber/multi_test/issues/26)) + ## [v0.1.2](https://github.com/cucumber/multi_test/compare/v0.1.1...v0.1.2) * Ensure that detecting assetion library doesn't fail if no test framework diff --git a/lib/multi_test.rb b/lib/multi_test.rb index f8717b5..1dfe398 100644 --- a/lib/multi_test.rb +++ b/lib/multi_test.rb @@ -1,32 +1,5 @@ require 'multi_test/assertion_library' module MultiTest - def self.disable_autorun - if defined?(Test::Unit::Runner) - Test::Unit::Runner.module_eval("@@stop_auto_run = true") - end - - if defined?(Minitest) - Minitest.instance_eval do - def run(*) - # propagate the exit code from cucumber or another runner - case $! - when SystemExit - $!.status - else - true - end - end - end - - if defined?(Minitest::Unit) - Minitest::Unit.class_eval do - def run(*) - end - end - end - end - end - def self.extend_with_best_assertion_library(object) AssertionLibrary.detect_best.extend_world(object) end diff --git a/test/gemfiles/activesupport-4/scenarios b/test/gemfiles/activesupport-4/scenarios index 726415f..bb0c25a 100644 --- a/test/gemfiles/activesupport-4/scenarios +++ b/test/gemfiles/activesupport-4/scenarios @@ -1,2 +1 @@ -require_activesupport_testing_autorun.rb minitest_assertions.rb diff --git a/test/gemfiles/activesupport-5/scenarios b/test/gemfiles/activesupport-5/scenarios index 726415f..bb0c25a 100644 --- a/test/gemfiles/activesupport-5/scenarios +++ b/test/gemfiles/activesupport-5/scenarios @@ -1,2 +1 @@ -require_activesupport_testing_autorun.rb minitest_assertions.rb diff --git a/test/gemfiles/minitest-4/scenarios b/test/gemfiles/minitest-4/scenarios index 8b68a9b..bb0c25a 100644 --- a/test/gemfiles/minitest-4/scenarios +++ b/test/gemfiles/minitest-4/scenarios @@ -1,3 +1 @@ -bundler_require.rb -minitest_propagate_exit_code.rb minitest_assertions.rb diff --git a/test/gemfiles/minitest-5/scenarios b/test/gemfiles/minitest-5/scenarios index 8b68a9b..bb0c25a 100644 --- a/test/gemfiles/minitest-5/scenarios +++ b/test/gemfiles/minitest-5/scenarios @@ -1,3 +1 @@ -bundler_require.rb -minitest_propagate_exit_code.rb minitest_assertions.rb diff --git a/test/gemfiles/plain-ruby/scenarios b/test/gemfiles/plain-ruby/scenarios index 8b465d2..bbdd8e4 100644 --- a/test/gemfiles/plain-ruby/scenarios +++ b/test/gemfiles/plain-ruby/scenarios @@ -1,3 +1,2 @@ -bundler_require.rb no_assertion_library.rb diff --git a/test/gemfiles/rspec-1/scenarios b/test/gemfiles/rspec-1/scenarios index 871eba8..7b5d086 100644 --- a/test/gemfiles/rspec-1/scenarios +++ b/test/gemfiles/rspec-1/scenarios @@ -1,3 +1,2 @@ -bundler_require.rb spec_matchers.rb diff --git a/test/gemfiles/rspec-2/scenarios b/test/gemfiles/rspec-2/scenarios index 9e3ed30..8058221 100644 --- a/test/gemfiles/rspec-2/scenarios +++ b/test/gemfiles/rspec-2/scenarios @@ -1,3 +1,2 @@ -bundler_require.rb rspec_matchers.rb diff --git a/test/gemfiles/rspec-3/scenarios b/test/gemfiles/rspec-3/scenarios index 6ad328a..70e8be3 100644 --- a/test/gemfiles/rspec-3/scenarios +++ b/test/gemfiles/rspec-3/scenarios @@ -1,2 +1 @@ -bundler_require.rb rspec_matchers.rb diff --git a/test/gemfiles/test-unit-2/scenarios b/test/gemfiles/test-unit-2/scenarios index 5e7425d..8b36e6e 100644 --- a/test/gemfiles/test-unit-2/scenarios +++ b/test/gemfiles/test-unit-2/scenarios @@ -1,3 +1 @@ -bundler_require.rb -require_test_unit.rb test_unit_assertions.rb diff --git a/test/gemfiles/test-unit-3/scenarios b/test/gemfiles/test-unit-3/scenarios index 5e7425d..8b36e6e 100644 --- a/test/gemfiles/test-unit-3/scenarios +++ b/test/gemfiles/test-unit-3/scenarios @@ -1,3 +1 @@ -bundler_require.rb -require_test_unit.rb test_unit_assertions.rb diff --git a/test/scenarios/bundler_require.rb b/test/scenarios/bundler_require.rb deleted file mode 100644 index 2eb0908..0000000 --- a/test/scenarios/bundler_require.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Imagine this is your rails app -Bundler.require - -# Now cucumber loads -require "multi_test" -MultiTest.disable_autorun - diff --git a/test/scenarios/minitest_propagate_exit_code.rb b/test/scenarios/minitest_propagate_exit_code.rb deleted file mode 100644 index b2747a1..0000000 --- a/test/scenarios/minitest_propagate_exit_code.rb +++ /dev/null @@ -1,9 +0,0 @@ -# Imagine this is your rails app -require 'minitest/autorun' - -# Now cucumber loads and exits successfully -require "multi_test" -MultiTest.disable_autorun -exit 0 - -# Our Minitest hook should propagate that healthy status code diff --git a/test/scenarios/require_activesupport_testing_autorun.rb b/test/scenarios/require_activesupport_testing_autorun.rb deleted file mode 100644 index c0a8162..0000000 --- a/test/scenarios/require_activesupport_testing_autorun.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'active_support/testing/autorun' - -require "multi_test" -MultiTest.disable_autorun diff --git a/test/scenarios/require_test_unit.rb b/test/scenarios/require_test_unit.rb deleted file mode 100644 index 80ab0e8..0000000 --- a/test/scenarios/require_test_unit.rb +++ /dev/null @@ -1,6 +0,0 @@ -# Imagine this is your rails app -require 'test/unit' - -# Now cucumber loads -require "multi_test" -MultiTest.disable_autorun