From a4a946ed1e1ed82b09ed7b9ea0b542889716a425 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Wed, 27 Nov 2013 13:08:07 -0700 Subject: Deprecate ActiveSupport::TestCase.describe Provide message to define ActiveSupport::TestCase.name instead. Allow calling describe with a block, which Minitest::Spec does. --- activesupport/lib/active_support/testing/declarative.rb | 17 ++++++++++++----- 1 file 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 -- cgit v1.2.3