aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-08-02 03:30:21 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-08-02 05:36:38 +0900
commit8d2866bb80fbe81acb04f5b0c44f152f571fb29f (patch)
tree7a2e4a4ab0653fc8f07a40bc025b737e99a1c6ad
parent98d0f7ebd34b858f12a12dcf37ae54fdbb5cab64 (diff)
downloadrails-8d2866bb80fbe81acb04f5b0c44f152f571fb29f.tar.gz
rails-8d2866bb80fbe81acb04f5b0c44f152f571fb29f.tar.bz2
rails-8d2866bb80fbe81acb04f5b0c44f152f571fb29f.zip
You give jruby_skip & rubinius_skip a good name
This hack prevails everywhere in the codebase by being copy & pasted, and it's actually not a negative thing but a necessary thing for framework implementors, so it should better have a name and be a thing. And with this commit, activesupport/test/abstract_unit.rb now doesn't silently autoload AS::TestCase, so we're ready to establish clearner environment for running AS tests (probably in later commits)
-rw-r--r--actionmailer/test/abstract_unit.rb13
-rw-r--r--actionpack/test/abstract_unit.rb13
-rw-r--r--actionview/test/abstract_unit.rb11
-rw-r--r--activemodel/test/cases/helper.rb13
-rw-r--r--activesupport/lib/active_support/test_case.rb2
-rw-r--r--activesupport/lib/active_support/testing/alternative_runtime_skipper.rb18
-rw-r--r--activesupport/test/abstract_unit.rb13
-rw-r--r--railties/test/abstract_unit.rb15
8 files changed, 20 insertions, 78 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index 0e31a81c8c..0f3490a85f 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -34,17 +34,4 @@ ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
ActionMailer::Base.delivery_job = ActionMailer::MailDeliveryJob
-class ActiveSupport::TestCase
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
-end
-
require_relative "../../tools/test_common"
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index ded93dd33f..238ce32ce6 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -350,19 +350,6 @@ class CommentsController < ResourcesController; end
class AccountsController < ResourcesController; end
class ImagesController < ResourcesController; end
-class ActiveSupport::TestCase
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
-end
-
class DrivenByRackTest < ActionDispatch::SystemTestCase
driven_by :rack_test
end
diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb
index 516631ddb2..debf553689 100644
--- a/actionview/test/abstract_unit.rb
+++ b/actionview/test/abstract_unit.rb
@@ -192,17 +192,6 @@ end
class ActiveSupport::TestCase
parallelize
-
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
end
require_relative "../../tools/test_common"
diff --git a/activemodel/test/cases/helper.rb b/activemodel/test/cases/helper.rb
index 483a108bda..786b54983c 100644
--- a/activemodel/test/cases/helper.rb
+++ b/activemodel/test/cases/helper.rb
@@ -11,17 +11,4 @@ I18n.enforce_available_locales = false
require "active_support/testing/autorun"
require "active_support/core_ext/integer/time"
-class ActiveModel::TestCase < ActiveSupport::TestCase
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
-end
-
require_relative "../../../tools/test_common"
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 0b1cefc5e1..c513c76315 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -13,6 +13,7 @@ require "active_support/testing/constant_lookup"
require "active_support/testing/time_helpers"
require "active_support/testing/file_fixtures"
require "active_support/testing/parallelization"
+require "active_support/testing/alternative_runtime_skipper"
require "concurrent/utility/processor_counter"
module ActiveSupport
@@ -143,6 +144,7 @@ module ActiveSupport
include ActiveSupport::Testing::TimeHelpers
include ActiveSupport::Testing::FileFixtures
extend ActiveSupport::Testing::Declarative
+ include ActiveSupport::Testing::AlternativeRuntimeSkipper
# test/unit backwards compatibility methods
diff --git a/activesupport/lib/active_support/testing/alternative_runtime_skipper.rb b/activesupport/lib/active_support/testing/alternative_runtime_skipper.rb
new file mode 100644
index 0000000000..f9e6eaff2f
--- /dev/null
+++ b/activesupport/lib/active_support/testing/alternative_runtime_skipper.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module ActiveSupport
+ module Testing
+ module AlternativeRuntimeSkipper
+ private
+ # Skips the current run on Rubinius using Minitest::Assertions#skip
+ def rubinius_skip(message = "")
+ skip message if RUBY_ENGINE == "rbx"
+ end
+
+ # Skips the current run on JRuby using Minitest::Assertions#skip
+ def jruby_skip(message = "")
+ skip message if defined?(JRUBY_VERSION)
+ end
+ end
+ end
+end
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb
index b46ad6842f..a14748a6b3 100644
--- a/activesupport/test/abstract_unit.rb
+++ b/activesupport/test/abstract_unit.rb
@@ -25,17 +25,4 @@ ActiveSupport.to_time_preserves_timezone = ENV["PRESERVE_TIMEZONES"] == "1"
# Disable available locale checks to avoid warnings running the test suite.
I18n.enforce_available_locales = false
-class ActiveSupport::TestCase
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
-end
-
require_relative "../../tools/test_common"
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb
index 9600194ed6..93d09aad55 100644
--- a/railties/test/abstract_unit.rb
+++ b/railties/test/abstract_unit.rb
@@ -18,19 +18,4 @@ module TestApp
end
end
-class ActiveSupport::TestCase
- include ActiveSupport::Testing::Stream
-
- private
- # Skips the current run on Rubinius using Minitest::Assertions#skip
- def rubinius_skip(message = "")
- skip message if RUBY_ENGINE == "rbx"
- end
-
- # Skips the current run on JRuby using Minitest::Assertions#skip
- def jruby_skip(message = "")
- skip message if defined?(JRUBY_VERSION)
- end
-end
-
require_relative "../../tools/test_common"