From 2c13a79147205107ed18da2cdade92491d8ad47e Mon Sep 17 00:00:00 2001 From: Dan Kubb Date: Sun, 6 Jul 2014 17:23:57 -0700 Subject: [PATCH] Add list of methods that will warn when undefined --- lib/mutant/subject/method/instance.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/mutant/subject/method/instance.rb b/lib/mutant/subject/method/instance.rb index 02009597..00a37c95 100644 --- a/lib/mutant/subject/method/instance.rb +++ b/lib/mutant/subject/method/instance.rb @@ -7,6 +7,9 @@ module Mutant NAME_INDEX = 0 SYMBOL = '#'.freeze + # A list of methods that will warn when they are undefined + WARN_METHODS_UNDEFINED = [:initialize, :__send__, :object_id].freeze + # Test if method is public # # @return [Boolean] @@ -26,8 +29,8 @@ module Mutant # def prepare expected_warnings = - if RUBY_ENGINE.eql?('ruby') && name.equal?(:initialize) - ["#{__FILE__}:#{__LINE__ + 5}: warning: undefining `initialize' may cause serious problems\n"] + if RUBY_ENGINE.eql?('ruby') && WARN_METHODS_UNDEFINED.include?(name) + ["#{__FILE__}:#{__LINE__ + 5}: warning: undefining `#{name}' may cause serious problems\n"] else [] end