Skip to content

Commit a09a19c

Browse files
author
Anna
committed
confirm that method is actually undefined
1 parent 05d5dc9 commit a09a19c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

test/cases/sqlserver_helper.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ module ClassMethods
5454
def self.extended(base)
5555
base.class_eval do
5656
Array(coerced_tests).each do |method_name|
57-
undef_method(method_name) rescue nil
58-
STDOUT.puts("Info: Undefined coerced test: #{self.name}##{method_name}")
57+
undefine_and_puts(method_name)
5958
end
6059
end
6160
end
@@ -66,10 +65,15 @@ def coerced_tests
6665

6766
def method_added(method)
6867
if coerced_tests && coerced_tests.include?(method)
69-
undef_method(method) rescue nil
70-
STDOUT.puts("Info: Undefined coerced test: #{self.name}##{method}")
68+
undefine_and_puts(method)
7169
end
7270
end
71+
72+
def undefine_and_puts(method)
73+
result = undef_method(method) rescue nil
74+
STDOUT.puts("Info: Undefined coerced test: #{self.name}##{method}") unless result.blank?
75+
end
76+
7377
end
7478
end
7579

@@ -132,5 +136,4 @@ def with_auto_connect(boolean)
132136

133137
# SQL Server.
134138
sqlserver_specific_schema_file = "#{SQLSERVER_SCHEMA_ROOT}/sqlserver_specific_schema.rb"
135-
eval(File.read(sqlserver_specific_schema_file))
136-
139+
eval(File.read(sqlserver_specific_schema_file))

0 commit comments

Comments
 (0)