protest 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -0
- data/lib/protest.rb +12 -0
- data/lib/protest/reports/summary.rb +4 -0
- data/lib/protest/runner.rb +2 -0
- data/lib/protest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0363b7887f87c45bc40276d7caabcbafed7c6a
|
4
|
+
data.tar.gz: 6ba853d2afd0e235e5e959a926c583a8d2d7815e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ebd8b63a5c053955b07d8dacb41a408463d4d36634d15515cd021309b81dea29eb3354dffd0ee4eb9b510e96498189f017fc544c4282341e3240de92a9f4328
|
7
|
+
data.tar.gz: a071b3dfd872066ff67d765416148a84a14ae3111550b5898d03333f83c44e9f5898c0ce32097b0b4a4a358fbf92311f7db94bb23cf0edfd71271ae9cc6727d0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -244,6 +244,20 @@ register your subclass by calling `Protest.add_report`. See the
|
|
244
244
|
documentation for details, or take a look at the source code for
|
245
245
|
`Protest::Reports::Progress` and `Protest::Reports::Documentation`.
|
246
246
|
|
247
|
+
## Failing Early
|
248
|
+
|
249
|
+
If needed, you can configure Protest to stop the execution when the first error
|
250
|
+
or failed assertion occurs.
|
251
|
+
|
252
|
+
This can be configured with the `fail_early` method:
|
253
|
+
|
254
|
+
```ruby
|
255
|
+
Protest.fail_early = true
|
256
|
+
```
|
257
|
+
|
258
|
+
This feature can be configured by passing a `PROTEST_FAIL_EARLY` environment
|
259
|
+
variable, to activate it you must set it to `"true"`.
|
260
|
+
|
247
261
|
## Using Rails?
|
248
262
|
|
249
263
|
If you are using Rails you may want to take a look at [protest-rails](http://github.com/matflores/protest-rails).
|
data/lib/protest.rb
CHANGED
@@ -31,6 +31,17 @@ module Protest
|
|
31
31
|
!!@autorun
|
32
32
|
end
|
33
33
|
|
34
|
+
# Set to +true+ if tests should stop on the first failure. Default is +false+
|
35
|
+
def self.fail_early=(flag)
|
36
|
+
@fail_early = flag
|
37
|
+
end
|
38
|
+
|
39
|
+
# Checks to see if tests should stop on the first failure. Default is +false+
|
40
|
+
# See Protest.fail_early=
|
41
|
+
def self.fail_early?
|
42
|
+
!!@fail_early
|
43
|
+
end
|
44
|
+
|
34
45
|
# Run all registered test cases through the selected report. You can pass
|
35
46
|
# arguments to the Report constructor here.
|
36
47
|
#
|
@@ -95,6 +106,7 @@ require "protest/reports/summary"
|
|
95
106
|
Protest.autorun = true
|
96
107
|
Protest.report_with((ENV["PROTEST_REPORT"] || "documentation").to_sym)
|
97
108
|
Protest.backtrace_filter = Protest::Utils::BacktraceFilter.new
|
109
|
+
Protest.fail_early = ENV["PROTEST_FAIL_EARLY"] == "true"
|
98
110
|
|
99
111
|
at_exit do
|
100
112
|
exit $!.status if $!.is_a?(SystemExit) && !$!.success?
|
@@ -2,8 +2,12 @@ module Protest
|
|
2
2
|
# The +:summary+ report will output a brief summary with the total number
|
3
3
|
# of tests, assertions, passed tests, pending tests, failed tests and
|
4
4
|
# errors.
|
5
|
+
#
|
6
|
+
# It will also output the list of pending tests, failed tests and errors.
|
5
7
|
class Reports::Summary < Report
|
6
8
|
on :end do |report|
|
9
|
+
report.summarize_pending_tests
|
10
|
+
report.summarize_errors
|
7
11
|
report.summarize_test_totals
|
8
12
|
end
|
9
13
|
end
|
data/lib/protest/runner.rb
CHANGED
@@ -32,9 +32,11 @@ module Protest
|
|
32
32
|
fire_event :pending, PendingTest.new(test, e)
|
33
33
|
rescue AssertionFailed => e
|
34
34
|
fire_event :failure, FailedTest.new(test, e)
|
35
|
+
exit 1 if Protest.fail_early?
|
35
36
|
rescue Exception => e
|
36
37
|
raise if e.is_a?(Interrupt)
|
37
38
|
fire_event :error, ErroredTest.new(test, e)
|
39
|
+
exit 1 if Protest.fail_early?
|
38
40
|
end
|
39
41
|
|
40
42
|
protected
|
data/lib/protest/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolás Sanguinetti
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Protest is a tiny, simple, and easy-to-extend test framework for ruby.
|
15
15
|
email: flores.matias@gmail.com
|