提交 a4a946ed 编写于 作者: M Mike Moore

Deprecate ActiveSupport::TestCase.describe

Provide message to define ActiveSupport::TestCase.name instead.
Allow calling describe with a block, which Minitest::Spec does.
上级 cea574b1
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册