Permalink
Browse files

refactored to reduce flay score. marked some stuff as nodoc because r…

…doc kinda sucks (STILL)

[git-p4: depot-paths = "//src/minitest/dev/": change = 7650]
  • Loading branch information...
1 parent 924b5e4 commit ef5507bbc35de4ade48ad1a0f350c21d9d1ecd6e @zenspider zenspider committed Jul 19, 2012
Showing with 8 additions and 10 deletions.
  1. +1 −1 lib/minitest/mock.rb
  2. +7 −9 lib/minitest/unit.rb
View
@@ -50,7 +50,7 @@ def expect(name, retval, args=[])
self
end
- def __call name, data
+ def __call name, data # :nodoc:
case data
when Hash then
"#{name}(#{data[:args].inspect[1..-2]}) => #{data[:retval].inspect}"
View
@@ -1239,7 +1239,11 @@ def self.setup_hooks # :nodoc:
end
def run_setup_hooks # :nodoc:
- self.class.setup_hooks.each do |hook|
+ _run_hooks self.class.setup_hooks
+ end
+
+ def _run_hooks hooks # :nodoc:
+ hooks.each do |hook|
if hook.respond_to?(:arity) && hook.arity == 1
hook.call(self)
else
@@ -1288,21 +1292,15 @@ def self.teardown_hooks # :nodoc:
end
def run_teardown_hooks # :nodoc:
- self.class.teardown_hooks.reverse.each do |hook|
- if hook.respond_to?(:arity) && hook.arity == 1
- hook.call(self)
- else
- hook.call
- end
- end
+ _run_hooks self.class.teardown_hooks
end
include MiniTest::Assertions
end # class TestCase
end # class Unit
end # module MiniTest
-Minitest = MiniTest # because ugh... I typo this all the time
+Minitest = MiniTest # :nodoc: because ugh... I typo this all the time
if $DEBUG then
module Test # :nodoc:

0 comments on commit ef5507b

Please sign in to comment.