Skip to content

Commit

Permalink
Abort Heckle if supplied method doesn't exist
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/heckle/dev/": change = 3005]
  • Loading branch information
kevinclark committed Feb 8, 2007
1 parent af5a6fb commit c2e1647
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/test_unit_heckler.rb
Expand Up @@ -21,6 +21,16 @@ def self.validate(klass_name, method_name = nil)
load_test_files
klass = klass_name.to_class

# Does the method exist?
klass_methods = klass.singleton_methods(false).collect {|meth| "self.#{meth}"}
if method_name
if method_name =~ /self\./
abort "Unknown method: #{klass_name}.#{method_name.gsub('self.', '')}" unless klass_methods.include? method_name
else
abort "Unknown method: #{klass_name}##{method_name}" unless klass.instance_methods(false).include? method_name
end
end

initial_time = Time.now

unless self.new(klass_name).tests_pass? then
Expand All @@ -38,8 +48,7 @@ def self.validate(klass_name, method_name = nil)
self.timeout = adjusted_timeout

puts "Initial tests pass. Let's rumble."

klass_methods = klass.singleton_methods(false).collect {|meth| "self.#{meth}"}

methods = method_name ? Array(method_name) : klass.instance_methods(false) + klass_methods

results = methods.map do |method_name|
Expand Down

0 comments on commit c2e1647

Please sign in to comment.