diff --git a/activesupport/lib/active_support/testing/declarative.rb b/activesupport/lib/active_support/testing/declarative.rb index 1fa73caefa8dc9ef22b3ce87593da191f8bc7fef..c349bb5fb1ffd40b6017041235fd1b6a1d8cbdbb 100644 --- a/activesupport/lib/active_support/testing/declarative.rb +++ b/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