diff options
Diffstat (limited to 'activesupport/lib/active_support/test_case.rb')
-rw-r--r-- | activesupport/lib/active_support/test_case.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index a6f3b43792..d2b8e602f9 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -3,25 +3,19 @@ require 'minitest/spec' require 'active_support/testing/setup_and_teardown' require 'active_support/testing/assertions' require 'active_support/testing/deprecation' -require 'active_support/testing/declarative' require 'active_support/testing/isolation' require 'active_support/testing/mocha_module' require 'active_support/core_ext/kernel/reporting' +require 'active_support/deprecation' module ActiveSupport class TestCase < ::MiniTest::Spec include ActiveSupport::Testing::MochaModule - if MiniTest::Unit::VERSION < '2.6.1' - class << self - alias :name :to_s - end - end - # Use AS::TestCase for the base class when describing a model register_spec_type(self) do |desc| - desc < ActiveRecord::Model + Class === desc && desc < ActiveRecord::Model end Assertion = MiniTest::Assertion @@ -41,7 +35,24 @@ module ActiveSupport include ActiveSupport::Testing::SetupAndTeardown include ActiveSupport::Testing::Assertions include ActiveSupport::Testing::Deprecation - extend ActiveSupport::Testing::Declarative + + def self.describe(text) + if block_given? + super + else + ActiveSupport::Deprecation.warn("`describe` without a block is deprecated, please switch to: `def self.name; #{text.inspect}; end`\n") + + class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 + def self.name + "#{text}" + end + RUBY_EVAL + end + end + + class << self + alias :test :it + end # test/unit backwards compatibility methods alias :assert_raise :assert_raises |