aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMike Moore <mike@blowmage.com>2013-11-27 13:08:07 -0700
committerMike Moore <mike@blowmage.com>2013-11-27 13:08:07 -0700
commita4a946ed1e1ed82b09ed7b9ea0b542889716a425 (patch)
treed254fac82913ce6c89d01b0d4efa6ade97960b18 /activesupport
parentcea574b1487b4456a08091110d49431572ae3ae6 (diff)
downloadrails-a4a946ed1e1ed82b09ed7b9ea0b542889716a425.tar.gz
rails-a4a946ed1e1ed82b09ed7b9ea0b542889716a425.tar.bz2
rails-a4a946ed1e1ed82b09ed7b9ea0b542889716a425.zip
Deprecate ActiveSupport::TestCase.describe
Provide message to define ActiveSupport::TestCase.name instead. Allow calling describe with a block, which Minitest::Spec does.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/testing/declarative.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/testing/declarative.rb b/activesupport/lib/active_support/testing/declarative.rb
index 1fa73caefa..c349bb5fb1 100644
--- a/activesupport/lib/active_support/testing/declarative.rb
+++ b/activesupport/lib/active_support/testing/declarative.rb
@@ -7,11 +7,18 @@ module ActiveSupport
unless method_defined?(:describe)
def self.describe(text)
- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def self.name
- "#{text}"
- end
- RUBY_EVAL
+ if block_given?
+ super
+ else
+ message = "`describe` without a block is deprecated, please switch to: `def self.name; #{text.inspect}; end`\n"
+ ActiveSupport::Deprecation.warn message
+
+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def self.name
+ "#{text}"
+ end
+ RUBY_EVAL
+ end
end
end