aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/declarative.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-03-12 13:34:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-03-12 13:34:07 -0700
commit28d05f0a80e640cc66a9cf77dcc44a673e85d4eb (patch)
tree23c25e852ce9cfb2a5867982369dcdf13bf3a0f9 /activesupport/lib/active_support/testing/declarative.rb
parent81d08abcccf2ef1b0ea6e98daf00f6ca375f3d8a (diff)
downloadrails-28d05f0a80e640cc66a9cf77dcc44a673e85d4eb.tar.gz
rails-28d05f0a80e640cc66a9cf77dcc44a673e85d4eb.tar.bz2
rails-28d05f0a80e640cc66a9cf77dcc44a673e85d4eb.zip
use method_defined? to check whether or not a method is defined
Diffstat (limited to 'activesupport/lib/active_support/testing/declarative.rb')
-rw-r--r--activesupport/lib/active_support/testing/declarative.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/declarative.rb b/activesupport/lib/active_support/testing/declarative.rb
index c349bb5fb1..e709e6edf5 100644
--- a/activesupport/lib/active_support/testing/declarative.rb
+++ b/activesupport/lib/active_support/testing/declarative.rb
@@ -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)