aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-11-27 12:15:56 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2013-11-27 12:15:56 -0800
commitdaef3d430acdcd3844dd246e0291dcbb170676b3 (patch)
treed254fac82913ce6c89d01b0d4efa6ade97960b18
parentcea574b1487b4456a08091110d49431572ae3ae6 (diff)
parenta4a946ed1e1ed82b09ed7b9ea0b542889716a425 (diff)
downloadrails-daef3d430acdcd3844dd246e0291dcbb170676b3.tar.gz
rails-daef3d430acdcd3844dd246e0291dcbb170676b3.tar.bz2
rails-daef3d430acdcd3844dd246e0291dcbb170676b3.zip
Merge pull request #13082 from blowmage/deprecate_describe
Deprecate ActiveSupport::TestCase.describe
-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