Permalink
Browse files

Merge pull request #13082 from blowmage/deprecate_describe

Deprecate ActiveSupport::TestCase.describe
  • Loading branch information...
2 parents cea574b + a4a946e commit daef3d430acdcd3844dd246e0291dcbb170676b3 @tenderlove tenderlove committed Nov 27, 2013
Showing with 12 additions and 5 deletions.
  1. +12 −5 activesupport/lib/active_support/testing/declarative.rb
@@ -7,11 +7,18 @@ def self.extended(klass) #:nodoc:
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

0 comments on commit daef3d4

Please sign in to comment.