mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
use method_defined? to check whether or not a method is defined
This commit is contained in:
parent
81d08abccc
commit
28d05f0a80
1 changed files with 1 additions and 1 deletions
|
@ -34,7 +34,7 @@ module ActiveSupport
|
|||
# end
|
||||
def test(name, &block)
|
||||
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
||||
defined = instance_method(test_name) rescue false
|
||||
defined = method_defined? test_name
|
||||
raise "#{test_name} is already defined in #{self}" if defined
|
||||
if block_given?
|
||||
define_method(test_name, &block)
|
||||
|
|
Loading…
Reference in a new issue