test_notifier 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -1
- data/.rubocop.yml +9 -0
- data/Gemfile +3 -1
- data/README.md +81 -0
- data/Rakefile +7 -0
- data/lib/test_notifier/runner/autotest.rb +37 -24
- data/lib/test_notifier/runner/minitest.rb +8 -6
- data/lib/test_notifier/runner/rspec.rb +2 -0
- data/lib/test_notifier/runner/rspec2.rb +39 -18
- data/lib/test_notifier/runner/rspec3.rb +44 -29
- data/lib/test_notifier/runner/spec.rb +21 -12
- data/lib/test_notifier/runner/test_unit.rb +28 -19
- data/lib/test_notifier/runner.rb +2 -0
- data/lib/test_notifier/stats.rb +38 -23
- data/lib/test_notifier/version.rb +4 -2
- data/lib/test_notifier.rb +34 -23
- data/spec/spec_helper.rb +6 -1
- data/spec/stats/minitest_spec.rb +9 -5
- data/spec/stats/rspec1_spec.rb +6 -4
- data/spec/stats/rspec_spec.rb +7 -5
- data/spec/stats/test_unit_spec.rb +9 -4
- data/spec/test_notifier_spec.rb +62 -22
- data/test_notifier.gemspec +17 -12
- metadata +44 -18
- data/Gemfile.lock +0 -32
- data/README.rdoc +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 48e80e39f269e2232354733498a32f2752e2d119786f5e6ed3694010194c006d
|
4
|
+
data.tar.gz: e24235a4358017441c12aab610ace1b43bfbaab5b65c899c3e128af53b9f7edf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80664726eaaa82e62db4970584a1cbe95246c2142ea09e88d0d8fbc8de438b1420ae9ad270f05d90a3d5d2c2543165942957915ef2f56114efbfa66605719179
|
7
|
+
data.tar.gz: 929599d9ea690c9e9bf7e189ce42c735abf9d83f961b16c70a3d1967053d516deb6d18bea39a212e4cd74412ff4b1e9669f0d41c85ef9920d6faea0ec4b96828
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Test Notifier
|
2
|
+
|
3
|
+
Inspired by
|
4
|
+
http://railstips.org/2007/7/23/autotest-growl-pass-fail-notifications
|
5
|
+
|
6
|
+
After using Growl notification, I decided to write my own plugin because I have
|
7
|
+
to work on Ubuntu and Mac OS X and I missed the notification on my Linux box.
|
8
|
+
This plugin works with Linux, Mac OS X and Windows. All you need to do is
|
9
|
+
install the specific notification library for your OS.
|
10
|
+
|
11
|
+
Instead of displaying lots of notifications for each failure, I prefer to be
|
12
|
+
notified about the whole test result (you'll have to check your log file anyway
|
13
|
+
in order to clean up the failures/errors).
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install test_notifier
|
19
|
+
```
|
20
|
+
|
21
|
+
Check <https://github.com/fnando/notifier> to see how you can configure a
|
22
|
+
notifier for your OS.
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
If you're using Test::Unit you should add
|
27
|
+
`require "test_notifier/runner/test_unit"` to your `test_helper.rb` file.
|
28
|
+
|
29
|
+
If you're using RSpec you should add `require "test_notifier/runner/spec"` to
|
30
|
+
your `spec_helper.rb` file. If you're using RSpec 2-3, you need to add
|
31
|
+
`require "test_notifier/runner/rspec"` instead.
|
32
|
+
|
33
|
+
If you're using Autotest you should add
|
34
|
+
`require "test_notifier/runner/autotest"` to the file `~/.autotest`
|
35
|
+
|
36
|
+
If you're using MiniTest you should add
|
37
|
+
`require "test_notifier/runner/minitest"` to your `test_helper.rb` file.
|
38
|
+
|
39
|
+
You can define your notifier.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
TestNotifier.default_notifier = :terminal_notifier
|
43
|
+
```
|
44
|
+
|
45
|
+
The available notifiers are `:terminal_notifier`, `:hud`, `:kdialog`,
|
46
|
+
`:knotify`, `:notify_send`, `:osd_cat`, and `:snarl`.
|
47
|
+
|
48
|
+
If you'd like to make Test Notifier optional for your project:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
TestNotifier.silence_no_notifier_warning = true
|
52
|
+
```
|
53
|
+
|
54
|
+
## Maintainer
|
55
|
+
|
56
|
+
- Nando Vieira - https://nandovieira.com
|
57
|
+
|
58
|
+
## Collaborators
|
59
|
+
|
60
|
+
https://github.com/fnando/test_notifier/graphs/contributors
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
(The MIT License)
|
65
|
+
|
66
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
67
|
+
this software and associated documentation files (the 'Software'), to deal in
|
68
|
+
the Software without restriction, including without limitation the rights to
|
69
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
70
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
71
|
+
subject to the following conditions:
|
72
|
+
|
73
|
+
The above copyright notice and this permission notice shall be included in all
|
74
|
+
copies or substantial portions of the Software.
|
75
|
+
|
76
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
77
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
78
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
79
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
80
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
81
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,36 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
|
3
5
|
Autotest.add_hook :ran_command do |at|
|
4
|
-
|
5
|
-
|
6
|
+
content = at.results.to_s
|
7
|
+
|
8
|
+
rspec_re = /(\d+) examples?, (\d+) failures?(, (\d+) pendings?)?/
|
9
|
+
test_unit_re = /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/
|
6
10
|
|
7
|
-
|
8
|
-
|
11
|
+
rspec_matches = content.match(rspec_re)
|
12
|
+
test_unit_matches = content.match(test_unit_re)
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
if rspec_matches
|
15
|
+
_, examples, failures, _, pending = *rspec_matches
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
:
|
17
|
-
|
17
|
+
stats = TestNotifier::Stats.new(
|
18
|
+
:spec,
|
19
|
+
{
|
20
|
+
count: examples,
|
21
|
+
failures: failures,
|
22
|
+
pending: pending
|
23
|
+
}
|
24
|
+
)
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
|
26
|
+
unless examples.to_i.zero?
|
27
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
28
|
+
end
|
29
|
+
elsif test_unit_matches
|
30
|
+
_, tests, assertions, failures, errors = *test_unit_matches
|
22
31
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
:
|
27
|
-
:
|
28
|
-
|
32
|
+
stats = TestNotifier::Stats.new(
|
33
|
+
:test_unit,
|
34
|
+
{
|
35
|
+
count: tests,
|
36
|
+
assertions: assertions,
|
37
|
+
failures: failures,
|
38
|
+
errors: errors
|
39
|
+
}
|
40
|
+
)
|
29
41
|
|
30
|
-
|
42
|
+
unless tests.to_i.zero?
|
43
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
31
44
|
end
|
32
|
-
rescue => e
|
33
|
-
puts e
|
34
|
-
puts e.backtrace
|
35
45
|
end
|
46
|
+
rescue StandardError => error
|
47
|
+
puts error
|
48
|
+
puts error.backtrace
|
36
49
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
require "minitest/unit"
|
3
5
|
|
@@ -5,11 +7,11 @@ MiniTest::Unit.after_tests do
|
|
5
7
|
runner = MiniTest::Unit.runner
|
6
8
|
|
7
9
|
stats = TestNotifier::Stats.new(:minitest, {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
count: runner.test_count,
|
11
|
+
assertions: runner.assertion_count,
|
12
|
+
failures: runner.failures,
|
13
|
+
errors: runner.errors
|
14
|
+
})
|
13
15
|
|
14
|
-
TestNotifier.notify(:
|
16
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
15
17
|
end
|
@@ -1,29 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
require "rspec/core/formatters/base_text_formatter"
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
module RSpec
|
7
|
+
module Core
|
8
|
+
module Formatters
|
9
|
+
class BaseTextFormatter
|
10
|
+
alias dump_summary_original dump_summary
|
6
11
|
|
7
|
-
|
8
|
-
|
12
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
13
|
+
dump_summary_original(
|
14
|
+
duration,
|
15
|
+
example_count,
|
16
|
+
failure_count,
|
17
|
+
pending_count
|
18
|
+
)
|
9
19
|
|
10
|
-
|
20
|
+
return if example_count.zero?
|
11
21
|
|
12
|
-
|
13
|
-
|
14
|
-
|
22
|
+
failure_filter = proc do |error|
|
23
|
+
error
|
24
|
+
.instance_variable_get(:@exception)
|
25
|
+
.instance_of?(RSpec::Expectations::ExpectationNotMetError)
|
26
|
+
end
|
15
27
|
|
16
|
-
|
17
|
-
|
18
|
-
|
28
|
+
error_filter = proc do |error|
|
29
|
+
%w[
|
30
|
+
RSpec::Expectations::ExpectationNotMetError
|
31
|
+
NilClass
|
32
|
+
].include?(error.instance_variable_get(:@exception).class.name)
|
33
|
+
end
|
19
34
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
35
|
+
stats = TestNotifier::Stats.new(
|
36
|
+
:rspec,
|
37
|
+
{
|
38
|
+
count: example_count,
|
39
|
+
failures: examples.count(&failure_filter),
|
40
|
+
pending: pending_count,
|
41
|
+
errors: examples.count(&error_filter)
|
42
|
+
}
|
43
|
+
)
|
26
44
|
|
27
|
-
|
45
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
28
49
|
end
|
29
50
|
end
|
@@ -1,35 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
require "rspec/core"
|
3
5
|
require "rspec/core/formatters/base_text_formatter"
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
7
|
+
module RSpec
|
8
|
+
module Core
|
9
|
+
module Formatters
|
10
|
+
class BaseTextFormatter
|
11
|
+
alias dump_summary_original dump_summary
|
12
|
+
|
13
|
+
def dump_summary(options)
|
14
|
+
dump_summary_original(options)
|
15
|
+
|
16
|
+
example_count = options.example_count
|
17
|
+
pending_count = options.pending_count
|
18
|
+
examples = options.examples
|
19
|
+
|
20
|
+
return if example_count.zero?
|
21
|
+
|
22
|
+
failure_filter = proc do |error|
|
23
|
+
error
|
24
|
+
.instance_variable_get(:@exception)
|
25
|
+
.instance_of?(RSpec::Expectations::ExpectationNotMetError)
|
26
|
+
end
|
27
|
+
|
28
|
+
error_filter = proc {|e|
|
29
|
+
%w[
|
30
|
+
RSpec::Expectations::ExpectationNotMetError
|
31
|
+
NilClass
|
32
|
+
].include?(e.instance_variable_get(:@exception).class.name)
|
33
|
+
}
|
34
|
+
|
35
|
+
stats = TestNotifier::Stats.new(
|
36
|
+
:rspec,
|
37
|
+
{
|
38
|
+
count: example_count,
|
39
|
+
failures: examples.count(&failure_filter),
|
40
|
+
pending: pending_count,
|
41
|
+
errors: examples.count(&error_filter)
|
42
|
+
}
|
43
|
+
)
|
44
|
+
|
45
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
34
49
|
end
|
35
50
|
end
|
@@ -1,21 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
require "spec/runner/formatter/base_text_formatter"
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
module Spec
|
7
|
+
module Runner
|
8
|
+
module Formatter
|
9
|
+
class BaseTextFormatter
|
10
|
+
alias dump_summary_original dump_summary
|
6
11
|
|
7
|
-
|
8
|
-
|
12
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
13
|
+
dump_summary_original(duration, example_count, failure_count,
|
14
|
+
pending_count)
|
9
15
|
|
10
|
-
|
16
|
+
return if example_count.zero?
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
stats = TestNotifier::Stats.new(:spec, {
|
19
|
+
count: example_count,
|
20
|
+
failures: failure_count,
|
21
|
+
pending: pending_count,
|
22
|
+
errors: nil
|
23
|
+
})
|
18
24
|
|
19
|
-
|
25
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
@@ -1,29 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "test_notifier"
|
2
4
|
require "test/unit/ui/console/testrunner"
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
module Test
|
7
|
+
module Unit
|
8
|
+
module UI
|
9
|
+
module Console
|
10
|
+
class TestRunner
|
11
|
+
alias finished_original finished
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
_, tests, assertions, failures, errors = *@result.to_s.match(re)
|
13
|
-
return if tests.to_i.zero?
|
13
|
+
def finished(elapsed_time)
|
14
|
+
finished_original(elapsed_time)
|
14
15
|
|
16
|
+
begin
|
17
|
+
re = /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/
|
18
|
+
_, tests, assertions, failures, errors = *@result.to_s.match(re)
|
19
|
+
return if tests.to_i.zero?
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
stats = TestNotifier::Stats.new(:test_unit, {
|
22
|
+
count: tests,
|
23
|
+
assertions: assertions,
|
24
|
+
failures: failures,
|
25
|
+
errors: errors
|
26
|
+
})
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
TestNotifier.notify(status: stats.status, message: stats.message)
|
29
|
+
rescue StandardError => error
|
30
|
+
puts error
|
31
|
+
puts error.backtrace
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
data/lib/test_notifier/runner.rb
CHANGED
data/lib/test_notifier/stats.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module TestNotifier
|
2
4
|
class Stats
|
3
5
|
attr_accessor :adapter, :options
|
@@ -17,15 +19,16 @@ module TestNotifier
|
|
17
19
|
send("message_for_#{adapter}")
|
18
20
|
end
|
19
21
|
|
20
|
-
private
|
21
|
-
|
22
|
-
|
22
|
+
private def normalize(options)
|
23
|
+
%i[
|
24
|
+
count success failures pending errors
|
25
|
+
assertions
|
26
|
+
].each_with_object({}) do |key, buffer|
|
23
27
|
buffer[key] = options[key].to_i
|
24
|
-
buffer
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
|
-
def status_for_minitest
|
31
|
+
private def status_for_minitest
|
29
32
|
if options[:errors].nonzero?
|
30
33
|
:error
|
31
34
|
elsif options[:failures].nonzero?
|
@@ -35,7 +38,7 @@ module TestNotifier
|
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
38
|
-
def status_for_test_unit
|
41
|
+
private def status_for_test_unit
|
39
42
|
if options[:errors].nonzero?
|
40
43
|
:error
|
41
44
|
elsif options[:failures].nonzero?
|
@@ -45,7 +48,7 @@ module TestNotifier
|
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
48
|
-
def status_for_rspec
|
51
|
+
private def status_for_rspec
|
49
52
|
if options[:errors].nonzero?
|
50
53
|
:error
|
51
54
|
elsif options[:failures].nonzero?
|
@@ -55,7 +58,7 @@ module TestNotifier
|
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
58
|
-
def status_for_spec
|
61
|
+
private def status_for_spec
|
59
62
|
if options[:failures].nonzero?
|
60
63
|
:fail
|
61
64
|
else
|
@@ -63,44 +66,56 @@ module TestNotifier
|
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
|
-
def message_for_rspec
|
67
|
-
options[:success] =
|
69
|
+
private def message_for_rspec
|
70
|
+
options[:success] =
|
71
|
+
options[:count] - (options[:failures] + options[:errors])
|
68
72
|
|
69
73
|
text = []
|
70
|
-
text << "#{options[:count]} " + pluralize(options[:count], "example")
|
74
|
+
text << ("#{options[:count]} " + pluralize(options[:count], "example"))
|
71
75
|
text << "#{options[:failures]} failed" unless options[:failures].zero?
|
72
76
|
text << "#{options[:pending]} pending" unless options[:pending].zero?
|
73
|
-
|
77
|
+
unless options[:errors].zero?
|
78
|
+
text << ("#{options[:errors]} " + pluralize(options[:errors],
|
79
|
+
"error"))
|
80
|
+
end
|
74
81
|
text.join(", ")
|
75
82
|
end
|
76
83
|
|
77
|
-
def message_for_spec
|
84
|
+
private def message_for_spec
|
78
85
|
text = []
|
79
|
-
text << "#{options[:count]} " + pluralize(options[:count], "example")
|
86
|
+
text << ("#{options[:count]} " + pluralize(options[:count], "example"))
|
80
87
|
text << "#{options[:failures]} failed" unless options[:failures].zero?
|
81
88
|
text << "#{options[:pending]} pending" unless options[:pending].zero?
|
82
89
|
text.join(", ")
|
83
90
|
end
|
84
91
|
|
85
|
-
def message_for_test_unit
|
92
|
+
private def message_for_test_unit
|
86
93
|
text = []
|
87
|
-
text << "#{options[:count]} " + pluralize(options[:count], "test")
|
88
|
-
text << "#{options[:assertions]} " + pluralize(options[:assertions],
|
94
|
+
text << ("#{options[:count]} " + pluralize(options[:count], "test"))
|
95
|
+
text << ("#{options[:assertions]} " + pluralize(options[:assertions],
|
96
|
+
"assertion"))
|
89
97
|
text << "#{options[:failures]} failed" unless options[:failures].zero?
|
90
|
-
|
98
|
+
unless options[:errors].zero?
|
99
|
+
text << ("#{options[:errors]} " + pluralize(options[:errors],
|
100
|
+
"error"))
|
101
|
+
end
|
91
102
|
text.join(", ")
|
92
103
|
end
|
93
104
|
|
94
|
-
def message_for_minitest
|
105
|
+
private def message_for_minitest
|
95
106
|
text = []
|
96
|
-
text << "#{options[:count]} " + pluralize(options[:count], "test")
|
97
|
-
text << "#{options[:assertions]} " + pluralize(options[:assertions],
|
107
|
+
text << ("#{options[:count]} " + pluralize(options[:count], "test"))
|
108
|
+
text << ("#{options[:assertions]} " + pluralize(options[:assertions],
|
109
|
+
"assertion"))
|
98
110
|
text << "#{options[:failures]} failed" unless options[:failures].zero?
|
99
|
-
|
111
|
+
unless options[:errors].zero?
|
112
|
+
text << ("#{options[:errors]} " + pluralize(options[:errors],
|
113
|
+
"error"))
|
114
|
+
end
|
100
115
|
text.join(", ")
|
101
116
|
end
|
102
117
|
|
103
|
-
def pluralize(count, text)
|
118
|
+
private def pluralize(count, text)
|
104
119
|
count > 1 ? "#{text}s" : text
|
105
120
|
end
|
106
121
|
end
|
data/lib/test_notifier.rb
CHANGED
@@ -1,42 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "notifier"
|
2
4
|
|
3
5
|
module TestNotifier
|
4
|
-
class << self
|
5
|
-
attr_accessor :silence_no_notifier_warning
|
6
|
-
end
|
7
|
-
|
8
6
|
extend self
|
9
7
|
|
10
|
-
NO_NOTIFIERS_MESSAGE = "[TEST NOTIFIER] You have no supported notifiers
|
8
|
+
NO_NOTIFIERS_MESSAGE = "[TEST NOTIFIER] You have no supported notifiers " \
|
9
|
+
"installed. Please read documentation.\n"
|
11
10
|
|
12
11
|
IMAGES = {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
}
|
12
|
+
fail: File.expand_path("#{__dir__}/../resources/fail.png"),
|
13
|
+
error: File.expand_path("#{__dir__}/../resources/error.png"),
|
14
|
+
success: File.expand_path("#{__dir__}/../resources/success.png")
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
HUD_SYMBOLS = {
|
18
|
+
fail: "exclamationmark.triangle",
|
19
|
+
error: "xmark.octagon.fill",
|
20
|
+
success: "checkmark.circle"
|
21
|
+
}.freeze
|
17
22
|
|
18
23
|
TITLES = {
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
}
|
24
|
+
fail: "Failed!",
|
25
|
+
success: "Passed!",
|
26
|
+
error: "Error!"
|
27
|
+
}.freeze
|
23
28
|
|
24
29
|
COLORS = {
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
}
|
30
|
+
fail: "orange",
|
31
|
+
success: "green",
|
32
|
+
error: "red"
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
attr_accessor :silence_no_notifier_warning
|
29
36
|
|
30
37
|
def default_notifier=(notifier)
|
31
38
|
Notifier.default_notifier = notifier
|
32
39
|
end
|
33
40
|
|
34
41
|
def notify(options)
|
35
|
-
options.merge
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
|
42
|
+
options = options.merge(
|
43
|
+
title: TITLES[options[:status]],
|
44
|
+
image: IMAGES[options[:status]],
|
45
|
+
color: COLORS[options[:status]]
|
46
|
+
)
|
47
|
+
|
48
|
+
if Notifier.notifier == Notifier::Hud
|
49
|
+
options[:image] = HUD_SYMBOLS[options[:status]]
|
50
|
+
end
|
40
51
|
|
41
52
|
notifier.notify(options)
|
42
53
|
end
|
@@ -45,7 +56,7 @@ module TestNotifier
|
|
45
56
|
notifier = Notifier.notifier
|
46
57
|
|
47
58
|
if notifier == Notifier::Placebo && !silence_no_notifier_warning
|
48
|
-
|
59
|
+
$stderr << NO_NOTIFIERS_MESSAGE
|
49
60
|
end
|
50
61
|
|
51
62
|
notifier
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/setup"
|
1
4
|
require "test_notifier"
|
2
5
|
|
3
6
|
module SpecHelpers
|
4
7
|
def unsupport_all_notifiers
|
5
8
|
Notifier.notifiers.each do |notifier|
|
6
|
-
|
9
|
+
unless notifier == Notifier::Placebo
|
10
|
+
allow(notifier).to receive(:supported?).and_return(false)
|
11
|
+
end
|
7
12
|
end
|
8
13
|
end
|
9
14
|
end
|
data/spec/stats/minitest_spec.rb
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe TestNotifier::Stats, "MiniTest" do
|
4
6
|
subject(:stats) { TestNotifier::Stats.new(:minitest) }
|
5
7
|
|
6
8
|
it "returns success message" do
|
7
|
-
stats.options = {
|
9
|
+
stats.options = {count: 10, assertions: 20}
|
8
10
|
expect(stats.message).to eql("10 tests, 20 assertions")
|
9
11
|
end
|
10
12
|
|
11
13
|
it "message with failing examples" do
|
12
|
-
stats.options = {
|
14
|
+
stats.options = {count: 10, assertions: 20, failures: 5}
|
13
15
|
expect(stats.message).to eql("10 tests, 20 assertions, 5 failed")
|
14
16
|
end
|
15
17
|
|
16
18
|
it "message with error examples" do
|
17
|
-
stats.options = {
|
19
|
+
stats.options = {count: 10, assertions: 20, errors: 5}
|
18
20
|
expect(stats.message).to eql("10 tests, 20 assertions, 5 errors")
|
19
21
|
end
|
20
22
|
|
21
23
|
it "message with all types" do
|
22
|
-
stats.options = {
|
24
|
+
stats.options = {
|
25
|
+
count: 6, failures: 2, errors: 3,
|
26
|
+
assertions: 20
|
27
|
+
}
|
23
28
|
expect(stats.message).to eql("6 tests, 20 assertions, 2 failed, 3 errors")
|
24
29
|
end
|
25
30
|
end
|
26
|
-
|
data/spec/stats/rspec1_spec.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe TestNotifier::Stats, "RSpec 1" do
|
4
6
|
subject(:stats) { TestNotifier::Stats.new(:spec) }
|
5
7
|
|
6
8
|
it "returns success message" do
|
7
|
-
stats.options = {
|
9
|
+
stats.options = {count: 10}
|
8
10
|
expect(stats.message).to eql("10 examples")
|
9
11
|
end
|
10
12
|
|
11
13
|
it "returns message with failing examples" do
|
12
|
-
stats.options = {
|
14
|
+
stats.options = {count: 10, failures: 5}
|
13
15
|
expect(stats.message).to eql("10 examples, 5 failed")
|
14
16
|
end
|
15
17
|
|
16
18
|
it "returns message with pending examples" do
|
17
|
-
stats.options = {
|
19
|
+
stats.options = {count: 10, pending: 5}
|
18
20
|
expect(stats.message).to eql("10 examples, 5 pending")
|
19
21
|
end
|
20
22
|
|
21
23
|
it "returns message with all types" do
|
22
|
-
stats.options = {
|
24
|
+
stats.options = {count: 6, failures: 2, pending: 3}
|
23
25
|
expect(stats.message).to eql("6 examples, 2 failed, 3 pending")
|
24
26
|
end
|
25
27
|
end
|
data/spec/stats/rspec_spec.rb
CHANGED
@@ -1,30 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe TestNotifier::Stats, "RSpec" do
|
4
6
|
subject(:stats) { TestNotifier::Stats.new(:rspec) }
|
5
7
|
|
6
8
|
it "returns success message" do
|
7
|
-
stats.options = {
|
9
|
+
stats.options = {count: 10}
|
8
10
|
expect(stats.message).to eql("10 examples")
|
9
11
|
end
|
10
12
|
|
11
13
|
it "returns message with failing examples" do
|
12
|
-
stats.options = {
|
14
|
+
stats.options = {count: 10, failures: 5}
|
13
15
|
expect(stats.message).to eql("10 examples, 5 failed")
|
14
16
|
end
|
15
17
|
|
16
18
|
it "returns message with pending examples" do
|
17
|
-
stats.options = {
|
19
|
+
stats.options = {count: 10, pending: 5}
|
18
20
|
expect(stats.message).to eql("10 examples, 5 pending")
|
19
21
|
end
|
20
22
|
|
21
23
|
it "returns message with error examples" do
|
22
|
-
stats.options = {
|
24
|
+
stats.options = {count: 10, failures: 5, errors: 5}
|
23
25
|
expect(stats.message).to eql("10 examples, 5 failed, 5 errors")
|
24
26
|
end
|
25
27
|
|
26
28
|
it "returns message with all types" do
|
27
|
-
stats.options = {
|
29
|
+
stats.options = {count: 6, failures: 3, errors: 2, pending: 3}
|
28
30
|
expect(stats.message).to eql("6 examples, 3 failed, 3 pending, 2 errors")
|
29
31
|
end
|
30
32
|
end
|
@@ -1,25 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe TestNotifier::Stats, "TestUnit" do
|
4
6
|
subject(:stats) { TestNotifier::Stats.new(:test_unit) }
|
5
7
|
|
6
8
|
it "returns success message" do
|
7
|
-
stats.options = {
|
9
|
+
stats.options = {count: 10, assertions: 20}
|
8
10
|
expect(stats.message).to eql("10 tests, 20 assertions")
|
9
11
|
end
|
10
12
|
|
11
13
|
it "returns message with failing examples" do
|
12
|
-
stats.options = {
|
14
|
+
stats.options = {count: 10, assertions: 20, failures: 5}
|
13
15
|
expect(stats.message).to eql("10 tests, 20 assertions, 5 failed")
|
14
16
|
end
|
15
17
|
|
16
18
|
it "message with error examples" do
|
17
|
-
stats.options = {
|
19
|
+
stats.options = {count: 10, assertions: 20, errors: 5}
|
18
20
|
expect(stats.message).to eql("10 tests, 20 assertions, 5 errors")
|
19
21
|
end
|
20
22
|
|
21
23
|
it "message with all types" do
|
22
|
-
stats.options = {
|
24
|
+
stats.options = {
|
25
|
+
count: 6, failures: 2, errors: 3,
|
26
|
+
assertions: 20
|
27
|
+
}
|
23
28
|
expect(stats.message).to eql("6 tests, 20 assertions, 2 failed, 3 errors")
|
24
29
|
end
|
25
30
|
end
|
data/spec/test_notifier_spec.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe TestNotifier do
|
4
6
|
before { unsupport_all_notifiers }
|
5
7
|
|
6
8
|
it "uses default notifier" do
|
7
|
-
allow(Notifier::
|
9
|
+
allow(Notifier::Hud).to receive(:supported?).and_return(true)
|
8
10
|
allow(Notifier::Snarl).to receive(:supported?).and_return(true)
|
9
11
|
TestNotifier.default_notifier = :snarl
|
10
12
|
|
@@ -12,40 +14,78 @@ describe TestNotifier do
|
|
12
14
|
end
|
13
15
|
|
14
16
|
it "outputs error message to $stderr when there's no supported notifier" do
|
15
|
-
expect(
|
17
|
+
expect($stderr).to receive(:<<).with(TestNotifier::NO_NOTIFIERS_MESSAGE)
|
16
18
|
expect(Notifier::Placebo).to receive(:notify)
|
17
19
|
|
18
|
-
TestNotifier.notify :
|
20
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
19
21
|
end
|
20
22
|
|
21
|
-
it "
|
23
|
+
it "doesn't output error message when silence_no_notifier_warning is true" do
|
22
24
|
TestNotifier.silence_no_notifier_warning = true
|
23
25
|
|
24
|
-
expect(
|
26
|
+
expect($stderr).not_to receive(:<<)
|
25
27
|
expect(Notifier::Placebo).to receive(:notify)
|
26
28
|
|
27
|
-
TestNotifier.notify :
|
29
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
28
30
|
end
|
29
31
|
|
30
|
-
it "
|
31
|
-
|
32
|
+
it "sends notification to supported notifier" do
|
33
|
+
args = {
|
34
|
+
status: :fail,
|
35
|
+
message: "You have failed!",
|
36
|
+
title: TestNotifier::TITLES[:fail],
|
37
|
+
image: TestNotifier::IMAGES[:fail],
|
38
|
+
color: TestNotifier::COLORS[:fail]
|
39
|
+
}
|
32
40
|
|
33
|
-
|
34
|
-
expect(Notifier::
|
41
|
+
allow(Notifier::Snarl).to receive(:supported?).and_return(true)
|
42
|
+
expect(Notifier::Snarl).to receive(:notify).with(args)
|
35
43
|
|
36
|
-
TestNotifier.notify :
|
44
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
37
45
|
end
|
38
46
|
|
39
|
-
it "
|
40
|
-
|
41
|
-
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
it "sets symbol name for hud notifier (failed)" do
|
48
|
+
args = {
|
49
|
+
message: "You have failed!",
|
50
|
+
title: "Failed!",
|
51
|
+
image: "exclamationmark.triangle",
|
52
|
+
color: "orange",
|
53
|
+
status: :fail
|
54
|
+
}
|
55
|
+
|
56
|
+
allow(Notifier::Hud).to receive(:supported?).and_return(true)
|
57
|
+
expect(Notifier::Hud).to receive(:notify).with(args)
|
58
|
+
|
59
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "sets symbol name for hud notifier (success)" do
|
63
|
+
args = {
|
64
|
+
message: "You passed!",
|
65
|
+
title: "Passed!",
|
66
|
+
image: "checkmark.circle",
|
67
|
+
color: "green",
|
68
|
+
status: :success
|
69
|
+
}
|
70
|
+
|
71
|
+
allow(Notifier::Hud).to receive(:supported?).and_return(true)
|
72
|
+
expect(Notifier::Hud).to receive(:notify).with(args)
|
73
|
+
|
74
|
+
TestNotifier.notify status: :success, message: "You passed!"
|
75
|
+
end
|
76
|
+
|
77
|
+
it "sets symbol name for hud notifier (error)" do
|
78
|
+
args = {
|
79
|
+
message: "You have errored!",
|
80
|
+
title: "Error!",
|
81
|
+
image: "xmark.octagon.fill",
|
82
|
+
color: "red",
|
83
|
+
status: :error
|
84
|
+
}
|
85
|
+
|
86
|
+
allow(Notifier::Hud).to receive(:supported?).and_return(true)
|
87
|
+
expect(Notifier::Hud).to receive(:notify).with(args)
|
88
|
+
|
89
|
+
TestNotifier.notify status: :error, message: "You have errored!"
|
50
90
|
end
|
51
91
|
end
|
data/test_notifier.gemspec
CHANGED
@@ -1,27 +1,32 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/test_notifier/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "test_notifier"
|
7
|
-
s.version =
|
7
|
+
s.version = TestNotifier::Version::STRING.to_s
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Nando Vieira"]
|
10
|
+
s.required_ruby_version = ">= 2.7"
|
10
11
|
s.email = ["fnando.vieira@gmail.com"]
|
11
12
|
s.homepage = "http://rubygems.org/gems/test_notifier"
|
12
|
-
s.summary = "Display system notifications (dbus,
|
13
|
-
|
14
|
-
Display system notifications
|
15
|
-
|
16
|
-
with
|
17
|
-
DESC
|
13
|
+
s.summary = "Display system notifications (dbus, terminal notifier, " \
|
14
|
+
"snarl, and more) after running tests."
|
15
|
+
s.description = "Display system notifications after running tests. It " \
|
16
|
+
"works on Mac OS X, Linux and Windows. Powerful when used " \
|
17
|
+
"with autotest or guard."
|
18
18
|
|
19
|
+
s.metadata["rubygems_mfa_required"] = "true"
|
19
20
|
s.files = `git ls-files`.split("\n")
|
20
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
|
23
|
+
File.basename(f)
|
24
|
+
end
|
22
25
|
s.require_paths = ["lib"]
|
23
26
|
|
24
27
|
s.add_dependency "notifier"
|
25
|
-
s.add_development_dependency "rspec", ">= 3.0.0"
|
26
28
|
s.add_development_dependency "rake"
|
29
|
+
s.add_development_dependency "rspec", ">= 3.0.0"
|
30
|
+
s.add_development_dependency "rubocop"
|
31
|
+
s.add_development_dependency "rubocop-fnando"
|
27
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notifier
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: 3.0.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rubocop
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -52,10 +66,22 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-fnando
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Display system notifications after running tests. It works on Mac OS
|
84
|
+
X, Linux and Windows. Powerful when used with autotest or guard.
|
59
85
|
email:
|
60
86
|
- fnando.vieira@gmail.com
|
61
87
|
executables: []
|
@@ -64,9 +90,9 @@ extra_rdoc_files: []
|
|
64
90
|
files:
|
65
91
|
- ".gitignore"
|
66
92
|
- ".rspec"
|
93
|
+
- ".rubocop.yml"
|
67
94
|
- Gemfile
|
68
|
-
-
|
69
|
-
- README.rdoc
|
95
|
+
- README.md
|
70
96
|
- Rakefile
|
71
97
|
- lib/test_notifier.rb
|
72
98
|
- lib/test_notifier/runner.rb
|
@@ -92,8 +118,9 @@ files:
|
|
92
118
|
- test_notifier.gemspec
|
93
119
|
homepage: http://rubygems.org/gems/test_notifier
|
94
120
|
licenses: []
|
95
|
-
metadata:
|
96
|
-
|
121
|
+
metadata:
|
122
|
+
rubygems_mfa_required: 'true'
|
123
|
+
post_install_message:
|
97
124
|
rdoc_options: []
|
98
125
|
require_paths:
|
99
126
|
- lib
|
@@ -101,18 +128,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
128
|
requirements:
|
102
129
|
- - ">="
|
103
130
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
131
|
+
version: '2.7'
|
105
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
133
|
requirements:
|
107
134
|
- - ">="
|
108
135
|
- !ruby/object:Gem::Version
|
109
136
|
version: '0'
|
110
137
|
requirements: []
|
111
|
-
|
112
|
-
|
113
|
-
signing_key:
|
138
|
+
rubygems_version: 3.3.7
|
139
|
+
signing_key:
|
114
140
|
specification_version: 4
|
115
|
-
summary: Display system notifications (dbus,
|
141
|
+
summary: Display system notifications (dbus, terminal notifier, snarl, and more) after
|
142
|
+
running tests.
|
116
143
|
test_files:
|
117
144
|
- spec/spec_helper.rb
|
118
145
|
- spec/stats/minitest_spec.rb
|
@@ -120,4 +147,3 @@ test_files:
|
|
120
147
|
- spec/stats/rspec_spec.rb
|
121
148
|
- spec/stats/test_unit_spec.rb
|
122
149
|
- spec/test_notifier_spec.rb
|
123
|
-
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
test_notifier (2.0.3)
|
5
|
-
notifier
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
diff-lcs (1.2.5)
|
11
|
-
notifier (0.5.0)
|
12
|
-
rake (10.3.2)
|
13
|
-
rspec (3.0.0)
|
14
|
-
rspec-core (~> 3.0.0)
|
15
|
-
rspec-expectations (~> 3.0.0)
|
16
|
-
rspec-mocks (~> 3.0.0)
|
17
|
-
rspec-core (3.0.0)
|
18
|
-
rspec-support (~> 3.0.0)
|
19
|
-
rspec-expectations (3.0.0)
|
20
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
-
rspec-support (~> 3.0.0)
|
22
|
-
rspec-mocks (3.0.1)
|
23
|
-
rspec-support (~> 3.0.0)
|
24
|
-
rspec-support (3.0.0)
|
25
|
-
|
26
|
-
PLATFORMS
|
27
|
-
ruby
|
28
|
-
|
29
|
-
DEPENDENCIES
|
30
|
-
rake
|
31
|
-
rspec (>= 3.0.0)
|
32
|
-
test_notifier!
|
data/README.rdoc
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
= Test Notifier
|
2
|
-
|
3
|
-
Inspired by http://railstips.org/2007/7/23/autotest-growl-pass-fail-notifications
|
4
|
-
|
5
|
-
After using Growl notification, I decided to write my own plugin because I have
|
6
|
-
to work on Ubuntu and Mac OS X and I missed the notification on my Linux box.
|
7
|
-
This plugin works with Linux, Mac OS X and Windows. All you need to do is
|
8
|
-
install the specific notification library for your OS.
|
9
|
-
|
10
|
-
Instead of displaying lots of notifications for each failure, I prefer to be
|
11
|
-
notified about the whole test result (you'll have to check your log
|
12
|
-
file anyway in order to clean up the failures/errors).
|
13
|
-
|
14
|
-
== Installation
|
15
|
-
|
16
|
-
gem install test_notifier
|
17
|
-
|
18
|
-
Check http://github.com/fnando/notifier to see how you can configure a notifier for your OS.
|
19
|
-
|
20
|
-
== Usage
|
21
|
-
|
22
|
-
If you're using Test::Unit you should add <tt>require "test_notifier/runner/test_unit"</tt> to your <tt>test_helper.rb</tt> file.
|
23
|
-
|
24
|
-
If you're using RSpec you should add <tt>require "test_notifier/runner/spec"</tt> to your <tt>spec_helper.rb</tt> file. If you're using RSpec 2-3, you need to add <tt>require "test_notifier/runner/rspec"</tt> instead.
|
25
|
-
|
26
|
-
If you're using Autotest you should add <tt>require "test_notifier/runner/autotest"</tt> to
|
27
|
-
the file <tt>~/.autotest</tt>
|
28
|
-
|
29
|
-
If you're using MiniTest you should add <tt>require "test_notifier/runner/minitest"</tt> to your <tt>test_helper.rb</tt> file.
|
30
|
-
|
31
|
-
You can define your notifier.
|
32
|
-
|
33
|
-
TestNotifier.default_notifier = :growl
|
34
|
-
|
35
|
-
The available notifiers are <tt>:growl</tt>, <tt>:kdialog</tt>, <tt>:knotify</tt>, <tt>:notify_send</tt>, <tt>:osd_cat</tt>, and <tt>:snarl</tt>.
|
36
|
-
|
37
|
-
If you'd like to make Test Notifier optional for your project:
|
38
|
-
|
39
|
-
TestNotifier.silence_no_notifier_warning = true
|
40
|
-
|
41
|
-
== Maintainer
|
42
|
-
|
43
|
-
* Nando Vieira - http://simplesideias.com.br
|
44
|
-
|
45
|
-
== Collaborators
|
46
|
-
|
47
|
-
* Szymon (jeznet) Jeż - http://github.com/jeznet
|
48
|
-
* Steve Halasz - http://github.com/woodchuck
|
49
|
-
* Khaja Minhajuddin - http://minhajuddin.com/
|
50
|
-
* Steve Sloan - http://github.com/CodeMonkeySteve
|
51
|
-
* Jordan Byron - http://jordanbyron.com
|
52
|
-
|
53
|
-
== License
|
54
|
-
|
55
|
-
(The MIT License)
|
56
|
-
|
57
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
58
|
-
a copy of this software and associated documentation files (the
|
59
|
-
'Software'), to deal in the Software without restriction, including
|
60
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
61
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
62
|
-
permit persons to whom the Software is furnished to do so, subject to
|
63
|
-
the following conditions:
|
64
|
-
|
65
|
-
The above copyright notice and this permission notice shall be
|
66
|
-
included in all copies or substantial portions of the Software.
|
67
|
-
|
68
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
69
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
70
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
71
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
72
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
73
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
74
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|