Permalink
Browse files

DRYing up code, removing non-essentials

  • Loading branch information...
1 parent 191a237 commit 22d100391c42a4af7517bf5fab7332dfcf524726 @peterc committed Oct 17, 2011
Showing with 9 additions and 10 deletions.
  1. +9 −10 lib/testrocket.rb
View
@@ -1,19 +1,18 @@
module TestRocket
extend Module.new { attr_accessor :out }
- def _test(a, b)
- send((call rescue()) ? a : b)
- end
+ def _test(a, b); send((call rescue()) ? a : b); end
- def +@; r = _test :_pass, :_fail; (TestRocket.out || $>) << r; r end
- def -@; r = _test :_fail, :_pass; (TestRocket.out || $>) << r; r end
- def ~@; r = _pend; (TestRocket.out || $>) << r; r end
- def !@; r = _desc; (TestRocket.out || $>) << r; r end
+ def +@; _show _test :_pass, :_fail end
+ def -@; _show _test :_fail, :_pass end
+ def ~@; _show _pend; end
+ def !@; _show _desc; end
+ def _show(r); (TestRocket.out || $>) << r; r end
def _pass; " OK\n"; end
- def _fail; " FAIL @ #{source_location.join(':')}\n"; end
- def _pend; "PENDING '#{call.to_s}' @ #{source_location.join(':')}\n"; end
- def _desc; " FIRE '#{call.to_s}'!\n"; end
+ def _fail; " FAIL @ #{source_location * ':'}\n"; end
+ def _pend; "PENDING '#{call}' @ #{source_location * ':'}\n"; end
+ def _desc; " FIRE '#{call}'!\n"; end
end
Proc.send :include, TestRocket

0 comments on commit 22d1003

Please sign in to comment.