Permalink
Browse files

Add command line option for selecting topten decorator.

  • Loading branch information...
1 parent 3f22685 commit 2aa109e39d739eaa8f0d97ff2ef254bb0950034a @trans trans committed Nov 25, 2012
Showing with 14 additions and 2 deletions.
  1. +13 −1 lib/turn/command.rb
  2. +1 −1 lib/turn/configuration.rb
View
14 lib/turn/command.rb
@@ -70,6 +70,9 @@ def self.main(*argv)
# Output mode.
attr :outmode
+ # Decorator mode.
+ attr :decmode
+
# Enable full backtrace
attr :trace
@@ -95,6 +98,7 @@ def initialize
@requires = []
@runmode = nil
@outmode = nil
+ @decmode = nil
@trace = nil
@natural = false
@verbose = false
@@ -219,10 +223,17 @@ def option_parser
end
opts.separator " "
+ opts.separator "DECORATOR MODES"
+
+ opts.on('--topten', "show only top ten slowest tests") do
+ @decmode = :topten
+ end
+
+ opts.separator " "
opts.separator "COMMAND OPTIONS"
opts.on('--debug', "turn debug mode on") do
- $DEBUG = true
+ $DEBUG = true
end
opts.on('--warn', "turn warnings on") do
@@ -258,6 +269,7 @@ def main(*argv)
c.tests = tests
c.runmode = runmode
c.format = outmode
+ c.mode = decmode
c.pattern = pattern
c.matchcase = matchcase
c.trace = trace
View
2 lib/turn/configuration.rb
@@ -36,7 +36,7 @@ class Configuration
# Reporter type.
attr_accessor :format
- # Report modifier.
+ # Report modifier. These act as decorators on the reporter class.
attr_accessor :mode
# Run mode, which defaults to `nil`, but can also be `:solo`,

0 comments on commit 2aa109e

Please sign in to comment.