From 5921cf0b45b602d02908f30da19f8e7aed262d88 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 8 Jul 2012 14:51:57 -0700 Subject: [PATCH] we still need `describe` as the implementation differs from minitest --- activesupport/lib/active_support/test_case.rb | 2 ++ .../lib/active_support/testing/declarative.rb | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 activesupport/lib/active_support/testing/declarative.rb diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index b6afeda966..e5e9aa8cc7 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -3,6 +3,7 @@ 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' @@ -34,6 +35,7 @@ module ActiveSupport include ActiveSupport::Testing::SetupAndTeardown include ActiveSupport::Testing::Assertions include ActiveSupport::Testing::Deprecation + extend ActiveSupport::Testing::Declarative class << self alias :test :it diff --git a/activesupport/lib/active_support/testing/declarative.rb b/activesupport/lib/active_support/testing/declarative.rb new file mode 100644 index 0000000000..db554a9542 --- /dev/null +++ b/activesupport/lib/active_support/testing/declarative.rb @@ -0,0 +1,22 @@ +module ActiveSupport + module Testing + module Declarative + + def self.extended(klass) #:nodoc: + klass.class_eval do + + unless method_defined?(:describe) + def self.describe(text) + class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 + def self.name + "#{text}" + end + RUBY_EVAL + end + end + + end + end + end + end +end