From a9444916ee63a9c5f113a7d4a7e9d6eeb39387b6 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 27 Dec 2013 11:30:53 +0100 Subject: [PATCH] Ensure backward compatibility between Minitest 5 and 4 Define Minitest::Test in case we are running the gist under Minitest 4 and avoid relying on MiniTest::Unit::TestCase to avoid displaying warning on version five. [ci skip] --- guides/bug_report_templates/action_controller_gem.rb | 5 ++++- guides/bug_report_templates/active_record_gem.rb | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/guides/bug_report_templates/action_controller_gem.rb b/guides/bug_report_templates/action_controller_gem.rb index 610eccc039..9387e3dc1d 100644 --- a/guides/bug_report_templates/action_controller_gem.rb +++ b/guides/bug_report_templates/action_controller_gem.rb @@ -29,6 +29,9 @@ end require 'minitest/autorun' require 'rack/test' +# Ensure backward compatibility with Minitest 4 +Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) + class BugTest < Minitest::Test include Rack::Test::Methods @@ -41,4 +44,4 @@ class BugTest < Minitest::Test def app Rails.application end -end \ No newline at end of file +end diff --git a/guides/bug_report_templates/active_record_gem.rb b/guides/bug_report_templates/active_record_gem.rb index 63fbe27aed..d72633d0b2 100644 --- a/guides/bug_report_templates/active_record_gem.rb +++ b/guides/bug_report_templates/active_record_gem.rb @@ -4,6 +4,9 @@ require 'active_record' require 'minitest/autorun' require 'logger' +# Ensure backward compatibility with Minitest 4 +Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) + # This connection will do for database-independent bug reports. ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord::Base.logger = Logger.new(STDOUT)