Skip to content

Commit

Permalink
Add command line option for selecting topten decorator.
Browse files Browse the repository at this point in the history
  • Loading branch information
trans committed Nov 25, 2012
1 parent 3f22685 commit 2aa109e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion lib/turn/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def self.main(*argv)
# Output mode.
attr :outmode

# Decorator mode.
attr :decmode

# Enable full backtrace
attr :trace

Expand All @@ -95,6 +98,7 @@ def initialize
@requires = []
@runmode = nil
@outmode = nil
@decmode = nil
@trace = nil
@natural = false
@verbose = false
Expand Down Expand Up @@ -218,11 +222,18 @@ def option_parser
@outmode = :marshal
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/turn/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down

0 comments on commit 2aa109e

Please sign in to comment.