test_notifier 2.0.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.rubocop.yml +13 -0
- data/Gemfile +3 -1
- data/README.md +58 -0
- data/Rakefile +16 -2
- data/lib/minitest/test_notifier_plugin.rb +7 -0
- data/lib/test_notifier/runner/minitest.rb +59 -10
- data/lib/test_notifier/runner/rspec.rb +47 -5
- data/lib/test_notifier/runner.rb +3 -2
- data/lib/test_notifier/stats.rb +32 -54
- data/lib/test_notifier/version.rb +5 -3
- data/lib/test_notifier.rb +37 -25
- data/resources/error.png +0 -0
- data/resources/fail.png +0 -0
- data/resources/success.png +0 -0
- data/test/fixtures/minitest_sample_test.rb +30 -0
- data/test/fixtures/rspec_sample_spec.rb +27 -0
- data/test/test_helper.rb +18 -0
- data/test/test_notifier/stats_minitest_test.rb +45 -0
- data/test/test_notifier/stats_rspec_test.rb +37 -0
- data/test/test_notifier_test.rb +96 -0
- data/test_notifier.gemspec +20 -14
- metadata +80 -41
- data/.rspec +0 -1
- data/Gemfile.lock +0 -32
- data/README.rdoc +0 -74
- data/lib/test_notifier/runner/autotest.rb +0 -36
- data/lib/test_notifier/runner/rspec2.rb +0 -29
- data/lib/test_notifier/runner/rspec3.rb +0 -35
- data/lib/test_notifier/runner/spec.rb +0 -21
- data/lib/test_notifier/runner/test_unit.rb +0 -29
- data/resources/register-growl.scpt +0 -0
- data/spec/spec_helper.rb +0 -13
- data/spec/stats/minitest_spec.rb +0 -26
- data/spec/stats/rspec1_spec.rb +0 -25
- data/spec/stats/rspec_spec.rb +0 -30
- data/spec/stats/test_unit_spec.rb +0 -25
- data/spec/test_notifier_spec.rb +0 -51
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class TestNotifierTest < Minitest::Test
|
|
6
|
+
setup { unsupport_all_notifiers }
|
|
7
|
+
teardown { TestNotifier.default_notifier = :hud }
|
|
8
|
+
|
|
9
|
+
test "uses default notifier" do
|
|
10
|
+
Notifier::Knotify.stubs(:supported?).returns(true)
|
|
11
|
+
Notifier::Snarl.stubs(:supported?).returns(true)
|
|
12
|
+
TestNotifier.default_notifier = :snarl
|
|
13
|
+
|
|
14
|
+
assert_equal Notifier::Snarl, TestNotifier.notifier
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
test "outputs error message to when there's no supported notifier" do
|
|
18
|
+
Notifier.stubs(:notifier).returns(Notifier::Noop)
|
|
19
|
+
TestNotifier.silence_no_notifier_warning = false
|
|
20
|
+
|
|
21
|
+
_, err = capture_io do
|
|
22
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
assert_includes err, TestNotifier::NO_NOTIFIERS_MESSAGE
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "doesn't output error message when silence is enabled" do
|
|
29
|
+
TestNotifier.silence_no_notifier_warning = true
|
|
30
|
+
|
|
31
|
+
$stderr.expects(:<<).never
|
|
32
|
+
Notifier::Noop.expects(:notify).at_least(1)
|
|
33
|
+
|
|
34
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
test "sends notification to supported notifier" do
|
|
38
|
+
args = {
|
|
39
|
+
status: :fail,
|
|
40
|
+
message: "You have failed!",
|
|
41
|
+
title: TestNotifier::TITLES[:fail],
|
|
42
|
+
image: TestNotifier::IMAGES[:fail],
|
|
43
|
+
color: TestNotifier::COLORS[:fail]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Notifier::Snarl.stubs(:supported?).returns(true)
|
|
47
|
+
Notifier::Snarl.expects(:notify).with(args)
|
|
48
|
+
|
|
49
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
test "sets symbol name for hud notifier (failed)" do
|
|
53
|
+
args = {
|
|
54
|
+
message: "You have failed!",
|
|
55
|
+
title: "Failed!",
|
|
56
|
+
image: "exclamationmark.triangle",
|
|
57
|
+
color: "orange",
|
|
58
|
+
status: :fail
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Notifier::Hud.stubs(:supported?).returns(true)
|
|
62
|
+
Notifier::Hud.expects(:notify).with(args)
|
|
63
|
+
|
|
64
|
+
TestNotifier.notify status: :fail, message: "You have failed!"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
test "sets symbol name for hud notifier (success)" do
|
|
68
|
+
args = {
|
|
69
|
+
message: "You passed!",
|
|
70
|
+
title: "Passed!",
|
|
71
|
+
image: "checkmark.circle",
|
|
72
|
+
color: "green",
|
|
73
|
+
status: :success
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Notifier::Hud.stubs(:supported?).returns(true)
|
|
77
|
+
Notifier::Hud.expects(:notify).with(args)
|
|
78
|
+
|
|
79
|
+
TestNotifier.notify status: :success, message: "You passed!"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
test "sets symbol name for hud notifier (error)" do
|
|
83
|
+
args = {
|
|
84
|
+
message: "You have errored!",
|
|
85
|
+
title: "Error!",
|
|
86
|
+
image: "xmark.octagon",
|
|
87
|
+
color: "red",
|
|
88
|
+
status: :error
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Notifier::Hud.stubs(:supported?).returns(true)
|
|
92
|
+
Notifier::Hud.expects(:notify).with(args)
|
|
93
|
+
|
|
94
|
+
TestNotifier.notify status: :error, message: "You have errored!"
|
|
95
|
+
end
|
|
96
|
+
end
|
data/test_notifier.gemspec
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
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.
|
|
10
|
+
s.required_ruby_version = ">= 3.4"
|
|
11
|
+
s.email = ["me@fnando.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
|
-
s.
|
|
21
|
-
|
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
|
|
22
|
+
File.basename(f)
|
|
23
|
+
end
|
|
22
24
|
s.require_paths = ["lib"]
|
|
23
25
|
|
|
24
26
|
s.add_dependency "notifier"
|
|
25
|
-
s.add_development_dependency "
|
|
27
|
+
s.add_development_dependency "minitest-utils"
|
|
28
|
+
s.add_development_dependency "mocha"
|
|
26
29
|
s.add_development_dependency "rake"
|
|
30
|
+
s.add_development_dependency "rspec"
|
|
31
|
+
s.add_development_dependency "rubocop"
|
|
32
|
+
s.add_development_dependency "rubocop-fnando"
|
|
27
33
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test_notifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nando Vieira
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: notifier
|
|
@@ -25,19 +24,33 @@ dependencies:
|
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: minitest-utils
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: '0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: mocha
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
41
54
|
- !ruby/object:Gem::Dependency
|
|
42
55
|
name: rake
|
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,48 +65,82 @@ dependencies:
|
|
|
52
65
|
- - ">="
|
|
53
66
|
- !ruby/object:Gem::Version
|
|
54
67
|
version: '0'
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rspec
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: rubocop
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: rubocop-fnando
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :development
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
110
|
+
description: Display system notifications after running tests. It works on Mac OS
|
|
111
|
+
X, Linux and Windows. Powerful when used with autotest or guard.
|
|
59
112
|
email:
|
|
60
|
-
- fnando.
|
|
113
|
+
- me@fnando.com
|
|
61
114
|
executables: []
|
|
62
115
|
extensions: []
|
|
63
116
|
extra_rdoc_files: []
|
|
64
117
|
files:
|
|
65
118
|
- ".gitignore"
|
|
66
|
-
- ".
|
|
119
|
+
- ".rubocop.yml"
|
|
67
120
|
- Gemfile
|
|
68
|
-
-
|
|
69
|
-
- README.rdoc
|
|
121
|
+
- README.md
|
|
70
122
|
- Rakefile
|
|
123
|
+
- lib/minitest/test_notifier_plugin.rb
|
|
71
124
|
- lib/test_notifier.rb
|
|
72
125
|
- lib/test_notifier/runner.rb
|
|
73
|
-
- lib/test_notifier/runner/autotest.rb
|
|
74
126
|
- lib/test_notifier/runner/minitest.rb
|
|
75
127
|
- lib/test_notifier/runner/rspec.rb
|
|
76
|
-
- lib/test_notifier/runner/rspec2.rb
|
|
77
|
-
- lib/test_notifier/runner/rspec3.rb
|
|
78
|
-
- lib/test_notifier/runner/spec.rb
|
|
79
|
-
- lib/test_notifier/runner/test_unit.rb
|
|
80
128
|
- lib/test_notifier/stats.rb
|
|
81
129
|
- lib/test_notifier/version.rb
|
|
82
130
|
- resources/error.png
|
|
83
131
|
- resources/fail.png
|
|
84
|
-
- resources/register-growl.scpt
|
|
85
132
|
- resources/success.png
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
133
|
+
- test/fixtures/minitest_sample_test.rb
|
|
134
|
+
- test/fixtures/rspec_sample_spec.rb
|
|
135
|
+
- test/test_helper.rb
|
|
136
|
+
- test/test_notifier/stats_minitest_test.rb
|
|
137
|
+
- test/test_notifier/stats_rspec_test.rb
|
|
138
|
+
- test/test_notifier_test.rb
|
|
92
139
|
- test_notifier.gemspec
|
|
93
140
|
homepage: http://rubygems.org/gems/test_notifier
|
|
94
141
|
licenses: []
|
|
95
|
-
metadata:
|
|
96
|
-
|
|
142
|
+
metadata:
|
|
143
|
+
rubygems_mfa_required: 'true'
|
|
97
144
|
rdoc_options: []
|
|
98
145
|
require_paths:
|
|
99
146
|
- lib
|
|
@@ -101,23 +148,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
101
148
|
requirements:
|
|
102
149
|
- - ">="
|
|
103
150
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '
|
|
151
|
+
version: '3.4'
|
|
105
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
153
|
requirements:
|
|
107
154
|
- - ">="
|
|
108
155
|
- !ruby/object:Gem::Version
|
|
109
156
|
version: '0'
|
|
110
157
|
requirements: []
|
|
111
|
-
|
|
112
|
-
rubygems_version: 2.2.2
|
|
113
|
-
signing_key:
|
|
158
|
+
rubygems_version: 4.0.3
|
|
114
159
|
specification_version: 4
|
|
115
|
-
summary: Display system notifications (dbus,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- spec/stats/minitest_spec.rb
|
|
119
|
-
- spec/stats/rspec1_spec.rb
|
|
120
|
-
- spec/stats/rspec_spec.rb
|
|
121
|
-
- spec/stats/test_unit_spec.rb
|
|
122
|
-
- spec/test_notifier_spec.rb
|
|
123
|
-
has_rdoc:
|
|
160
|
+
summary: Display system notifications (dbus, terminal notifier, snarl, and more) after
|
|
161
|
+
running tests.
|
|
162
|
+
test_files: []
|
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color
|
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.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
|
|
3
|
-
Autotest.add_hook :ran_command do |at|
|
|
4
|
-
begin
|
|
5
|
-
content = at.results.to_s
|
|
6
|
-
|
|
7
|
-
rspec_matches = content.match(/(\d+) examples?, (\d+) failures?(, (\d+) pendings?)?/)
|
|
8
|
-
test_unit_matches = content.match(/(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/)
|
|
9
|
-
|
|
10
|
-
if rspec_matches
|
|
11
|
-
_, examples, failures, _, pending = *rspec_matches
|
|
12
|
-
|
|
13
|
-
stats = TestNotifier::Stats.new(:spec, {
|
|
14
|
-
:count => examples,
|
|
15
|
-
:failures => failures,
|
|
16
|
-
:pending => pending
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message) unless examples.to_i.zero?
|
|
20
|
-
elsif test_unit_matches
|
|
21
|
-
_, tests, assertions, failures, errors = *test_unit_matches
|
|
22
|
-
|
|
23
|
-
stats = TestNotifier::Stats.new(:test_unit, {
|
|
24
|
-
:count => tests,
|
|
25
|
-
:assertions => assertions,
|
|
26
|
-
:failures => failures,
|
|
27
|
-
:errors => errors
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message) unless tests.to_i.zero?
|
|
31
|
-
end
|
|
32
|
-
rescue => e
|
|
33
|
-
puts e
|
|
34
|
-
puts e.backtrace
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
require "rspec/core/formatters/base_text_formatter"
|
|
3
|
-
|
|
4
|
-
class RSpec::Core::Formatters::BaseTextFormatter
|
|
5
|
-
alias dump_summary_original dump_summary
|
|
6
|
-
|
|
7
|
-
def dump_summary(duration, example_count, failure_count, pending_count)
|
|
8
|
-
dump_summary_original(duration, example_count, failure_count, pending_count)
|
|
9
|
-
|
|
10
|
-
return if example_count.zero?
|
|
11
|
-
|
|
12
|
-
failure_filter = proc {|e|
|
|
13
|
-
e.instance_variable_get("@exception").class.name == "RSpec::Expectations::ExpectationNotMetError"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
error_filter = proc {|e|
|
|
17
|
-
%w[RSpec::Expectations::ExpectationNotMetError NilClass].include?(e.instance_variable_get("@exception").class.name)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
stats = TestNotifier::Stats.new(:rspec, {
|
|
21
|
-
:count => example_count,
|
|
22
|
-
:failures => examples.select(&failure_filter).count,
|
|
23
|
-
:pending => pending_count,
|
|
24
|
-
:errors => examples.reject(&error_filter).count
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
require "rspec/core"
|
|
3
|
-
require "rspec/core/formatters/base_text_formatter"
|
|
4
|
-
|
|
5
|
-
class RSpec::Core::Formatters::BaseTextFormatter
|
|
6
|
-
alias dump_summary_original dump_summary
|
|
7
|
-
|
|
8
|
-
def dump_summary(options)
|
|
9
|
-
dump_summary_original(options)
|
|
10
|
-
|
|
11
|
-
example_count = options.example_count
|
|
12
|
-
failure_count = options.failure_count
|
|
13
|
-
pending_count = options.pending_count
|
|
14
|
-
examples = options.examples
|
|
15
|
-
|
|
16
|
-
return if example_count.zero?
|
|
17
|
-
|
|
18
|
-
failure_filter = proc {|e|
|
|
19
|
-
e.instance_variable_get("@exception").class.name == "RSpec::Expectations::ExpectationNotMetError"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
error_filter = proc {|e|
|
|
23
|
-
%w[RSpec::Expectations::ExpectationNotMetError NilClass].include?(e.instance_variable_get("@exception").class.name)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
stats = TestNotifier::Stats.new(:rspec, {
|
|
27
|
-
:count => example_count,
|
|
28
|
-
:failures => examples.select(&failure_filter).count,
|
|
29
|
-
:pending => pending_count,
|
|
30
|
-
:errors => examples.reject(&error_filter).count
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
require "spec/runner/formatter/base_text_formatter"
|
|
3
|
-
|
|
4
|
-
class Spec::Runner::Formatter::BaseTextFormatter
|
|
5
|
-
alias dump_summary_original dump_summary
|
|
6
|
-
|
|
7
|
-
def dump_summary(duration, example_count, failure_count, pending_count)
|
|
8
|
-
dump_summary_original(duration, example_count, failure_count, pending_count)
|
|
9
|
-
|
|
10
|
-
return if example_count.zero?
|
|
11
|
-
|
|
12
|
-
stats = TestNotifier::Stats.new(:spec, {
|
|
13
|
-
:count => example_count,
|
|
14
|
-
:failures => failure_count,
|
|
15
|
-
:pending => pending_count,
|
|
16
|
-
:errors => nil
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
require "test/unit/ui/console/testrunner"
|
|
3
|
-
|
|
4
|
-
class Test::Unit::UI::Console::TestRunner
|
|
5
|
-
alias finished_original finished
|
|
6
|
-
|
|
7
|
-
def finished(elapsed_time)
|
|
8
|
-
finished_original(elapsed_time)
|
|
9
|
-
|
|
10
|
-
begin
|
|
11
|
-
re = /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/
|
|
12
|
-
_, tests, assertions, failures, errors = *@result.to_s.match(re)
|
|
13
|
-
return if tests.to_i.zero?
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
stats = TestNotifier::Stats.new(:test_unit, {
|
|
17
|
-
:count => tests,
|
|
18
|
-
:assertions => assertions,
|
|
19
|
-
:failures => failures,
|
|
20
|
-
:errors => errors
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
|
24
|
-
rescue => e
|
|
25
|
-
puts e
|
|
26
|
-
puts e.backtrace
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
Binary file
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require "test_notifier"
|
|
2
|
-
|
|
3
|
-
module SpecHelpers
|
|
4
|
-
def unsupport_all_notifiers
|
|
5
|
-
Notifier.notifiers.each do |notifier|
|
|
6
|
-
allow(notifier).to receive(:supported?).and_return(false) unless notifier == Notifier::Placebo
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
RSpec.configure do |config|
|
|
12
|
-
config.include SpecHelpers
|
|
13
|
-
end
|
data/spec/stats/minitest_spec.rb
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe TestNotifier::Stats, "MiniTest" do
|
|
4
|
-
subject(:stats) { TestNotifier::Stats.new(:minitest) }
|
|
5
|
-
|
|
6
|
-
it "returns success message" do
|
|
7
|
-
stats.options = { :count => 10, :assertions => 20 }
|
|
8
|
-
expect(stats.message).to eql("10 tests, 20 assertions")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "message with failing examples" do
|
|
12
|
-
stats.options = { :count => 10, :assertions => 20, :failures => 5 }
|
|
13
|
-
expect(stats.message).to eql("10 tests, 20 assertions, 5 failed")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "message with error examples" do
|
|
17
|
-
stats.options = { :count => 10, :assertions => 20, :errors => 5 }
|
|
18
|
-
expect(stats.message).to eql("10 tests, 20 assertions, 5 errors")
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "message with all types" do
|
|
22
|
-
stats.options = { :count => 6, :failures => 2, :errors => 3, :assertions => 20 }
|
|
23
|
-
expect(stats.message).to eql("6 tests, 20 assertions, 2 failed, 3 errors")
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
data/spec/stats/rspec1_spec.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe TestNotifier::Stats, "RSpec 1" do
|
|
4
|
-
subject(:stats) { TestNotifier::Stats.new(:spec) }
|
|
5
|
-
|
|
6
|
-
it "returns success message" do
|
|
7
|
-
stats.options = { :count => 10 }
|
|
8
|
-
expect(stats.message).to eql("10 examples")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "returns message with failing examples" do
|
|
12
|
-
stats.options = { :count => 10, :failures => 5 }
|
|
13
|
-
expect(stats.message).to eql("10 examples, 5 failed")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "returns message with pending examples" do
|
|
17
|
-
stats.options = { :count => 10, :pending => 5 }
|
|
18
|
-
expect(stats.message).to eql("10 examples, 5 pending")
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "returns message with all types" do
|
|
22
|
-
stats.options = { :count => 6, :failures => 2, :pending => 3 }
|
|
23
|
-
expect(stats.message).to eql("6 examples, 2 failed, 3 pending")
|
|
24
|
-
end
|
|
25
|
-
end
|