Skip to content

Commit

Permalink
Add an option to fail with the first assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed Feb 20, 2014
1 parent 7c0d5d5 commit e030d89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/peck
Expand Up @@ -15,6 +15,7 @@ Usage: peck [options] [files]
-t, --match-text run tests that match a given string
-a, --recently-accessed run tests that have been updated in the last 15 minutes
-S, --no-strip-backtrace doesn't strip anything from the backtrace
-f, --fail-fast fail with the first failing assertion
-d, --debug log debug messages to stdout
-h, --help show this message
EOF
Expand Down Expand Up @@ -42,6 +43,10 @@ if options.first['S'] || options.first['no-strip-backtrace']
Peck.clean_backtrace = false
end

if options.first['f'] || options.first['fail-fast']
Peck.fail_fast = true
end

unless (%w(d debug) & options.first.keys).empty?
require File.expand_path('../../lib/peck/debug', __FILE__)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/peck.rb
Expand Up @@ -30,6 +30,9 @@ class << self

# Sets whether the backtrace should be cleaned in case of a failure
attr_accessor :clean_backtrace

# Sets whether Peck should exit at the first failing assertion
attr_accessor :fail_fast
end

# A no-op unless you require 'peck/debug'
Expand Down

0 comments on commit e030d89

Please sign in to comment.