diff options
author | Mike Moore <mike@blowmage.com> | 2013-11-27 13:08:07 -0700 |
---|---|---|
committer | Mike Moore <mike@blowmage.com> | 2013-11-27 13:08:07 -0700 |
commit | a4a946ed1e1ed82b09ed7b9ea0b542889716a425 (patch) | |
tree | d254fac82913ce6c89d01b0d4efa6ade97960b18 /activesupport | |
parent | cea574b1487b4456a08091110d49431572ae3ae6 (diff) | |
download | rails-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.rb | 17 |
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 |