peck 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/peck +5 -0
  3. data/lib/peck.rb +10 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8afb31049d263dba0b2e5a7a5bb5dbeb05c6a1f6
4
- data.tar.gz: 89dc4d2874caa710e1117085fbaf605715c7c3bd
3
+ metadata.gz: 53dc1c47e6cacb7a91a7a6bee9c92e6bf0c25f4d
4
+ data.tar.gz: 38d1273aef3190dcaa77ad9d5d95df1798a35448
5
5
  SHA512:
6
- metadata.gz: 1a27eff417e8f21db1e216c36a804eba5f7ea407543c0bfcf5adf5195c0f8353b94a4355bf4d29e130cf5c307cfa63efdb61c07c59fcbc9b5d2c4cf627d6749d
7
- data.tar.gz: 59d2f2b1255360b94b2d5fe8574389bfecdc7bb49dfc47e26ea17cdc5924ff43e2e7d22686900a97a389fe601633cdc8950fb8ac5aa31248bda5dbd405f7ef27
6
+ metadata.gz: ae0a2b19435f162c23f7ec9886fdb46d60800a1d246b5df151815c9143e0d7f5cacea4aab6e775b7fdb2119e0f37a5ffe54c569cec1b12d7316b3ba1e3f54432
7
+ data.tar.gz: d89c1678a758395746ef7be10642909e3fec5daf07ae68093411c065ad442a9ebfe239fb6054ed94d88467e52a8024618142e9c3bf4f23774c2fc47f7cc1e200
data/bin/peck CHANGED
@@ -15,6 +15,7 @@ Usage: peck [options] [files]
15
15
  -t, --match-text run tests that match a given string
16
16
  -a, --recently-accessed run tests that have been updated in the last 15 minutes
17
17
  -S, --no-strip-backtrace doesn't strip anything from the backtrace
18
+ -f, --fail-fast fail with the first failing assertion
18
19
  -d, --debug log debug messages to stdout
19
20
  -h, --help show this message
20
21
  EOF
@@ -42,6 +43,10 @@ if options.first['S'] || options.first['no-strip-backtrace']
42
43
  Peck.clean_backtrace = false
43
44
  end
44
45
 
46
+ if options.first['f'] || options.first['fail-fast']
47
+ Peck.fail_fast = true
48
+ end
49
+
45
50
  unless (%w(d debug) & options.first.keys).empty?
46
51
  require File.expand_path('../../lib/peck/debug', __FILE__)
47
52
  end
data/lib/peck.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'thread'
4
4
 
5
5
  class Peck
6
- VERSION = "0.5.2"
6
+ VERSION = "0.5.3"
7
7
 
8
8
  class << self
9
9
  # Returns all the defined contexts.
@@ -30,6 +30,9 @@ class Peck
30
30
 
31
31
  # Sets whether the backtrace should be cleaned in case of a failure
32
32
  attr_accessor :clean_backtrace
33
+
34
+ # Sets whether Peck should exit at the first failing assertion
35
+ attr_accessor :fail_fast
33
36
  end
34
37
 
35
38
  # A no-op unless you require 'peck/debug'
@@ -77,12 +80,17 @@ class Peck
77
80
  end
78
81
  end
79
82
 
83
+ def self.stop_early?
84
+ Peck.fail_fast && Peck.counter.failed > 0
85
+ end
86
+
80
87
  def self.run_serial
81
88
  Peck.log("Running specs in serial")
82
89
  Thread.current['peck-semaphore'] = Mutex.new
83
90
  contexts.each do |context|
84
91
  context.specs.each do |specification|
85
92
  specification.run(delegates)
93
+ return if stop_early?
86
94
  end
87
95
  end
88
96
  rescue Exception => e
@@ -100,6 +108,7 @@ class Peck
100
108
  spec_index = Thread.exclusive { current_spec += 1 }
101
109
  if specification = specs[spec_index]
102
110
  specification.run(delegates)
111
+ return if stop_early?
103
112
  else
104
113
  break
105
114
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-22 00:00:00.000000000 Z
11
+ date: 2014-02-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Concurrent spec framework.