From 407e43866e2e5bb91eb7e3de2f9bed57cd25abc2 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 14 Aug 2016 04:34:35 +0900 Subject: Consolidate `ActiveRecord::TestCase` and `ActiveSupport::TestCase` in AR test cases --- activerecord/test/cases/helper.rb | 17 ----------------- activerecord/test/cases/test_case.rb | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index ebd4437a87..f1d69a215a 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -1,7 +1,5 @@ require "config" -require "active_support/testing/autorun" -require "active_support/testing/method_call_assertions" require "stringio" require "active_record" @@ -134,21 +132,6 @@ def disable_extension!(extension, connection) connection.reconnect! end -require "cases/validations_repair_helper" -class ActiveSupport::TestCase - include ActiveRecord::TestFixtures - include ActiveRecord::ValidationsRepairHelper - include ActiveSupport::Testing::MethodCallAssertions - - self.fixture_path = FIXTURES_ROOT - self.use_instantiated_fixtures = false - self.use_transactional_tests = true - - def create_fixtures(*fixture_set_names, &block) - ActiveRecord::FixtureSet.create_fixtures(ActiveSupport::TestCase.fixture_path, fixture_set_names, fixture_class_names, &block) - end -end - def load_schema # silence verbose schema loading original_stdout = $stdout diff --git a/activerecord/test/cases/test_case.rb b/activerecord/test/cases/test_case.rb index b4f5226f2b..7e8746b4f7 100644 --- a/activerecord/test/cases/test_case.rb +++ b/activerecord/test/cases/test_case.rb @@ -1,13 +1,29 @@ require "active_support/test_case" +require "active_support/testing/autorun" +require "active_support/testing/method_call_assertions" require "active_support/testing/stream" require "active_support/core_ext/regexp" +require "active_record/fixtures" + +require "cases/validations_repair_helper" module ActiveRecord # = Active Record Test Case # # Defines some test assertions to test against SQL queries. class TestCase < ActiveSupport::TestCase #:nodoc: + include ActiveSupport::Testing::MethodCallAssertions include ActiveSupport::Testing::Stream + include ActiveRecord::TestFixtures + include ActiveRecord::ValidationsRepairHelper + + self.fixture_path = FIXTURES_ROOT + self.use_instantiated_fixtures = false + self.use_transactional_tests = true + + def create_fixtures(*fixture_set_names, &block) + ActiveRecord::FixtureSet.create_fixtures(ActiveRecord::TestCase.fixture_path, fixture_set_names, fixture_class_names, &block) + end def teardown SQLCounter.clear_log -- cgit v1.2.3