test_notifier 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +22 -0
- data/README.rdoc +3 -0
- data/lib/test_notifier/runner/minitest.rb +15 -0
- data/lib/test_notifier/stats.rb +19 -0
- data/lib/test_notifier/version.rb +2 -2
- data/test/stats_test.rb +26 -0
- data/test_notifier.gemspec +1 -0
- metadata +67 -68
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
test_notifier (0.4.0)
|
5
|
+
notifier
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://gems.simplesideias.com.br/
|
9
|
+
specs:
|
10
|
+
mocha (0.9.12)
|
11
|
+
notifier (0.1.3)
|
12
|
+
rake (0.9.2)
|
13
|
+
test-unit (2.3.1)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
mocha
|
20
|
+
rake
|
21
|
+
test-unit
|
22
|
+
test_notifier!
|
data/README.rdoc
CHANGED
@@ -26,6 +26,8 @@ If you're using RSpec you should add <tt>require "test_notifier/runner/spec"</tt
|
|
26
26
|
If you're using Autotest you should add <tt>require test_notifier/runner/autotest"</tt> to
|
27
27
|
the file <tt>~/.autotest</tt>
|
28
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
|
+
|
29
31
|
You can define your notifier.
|
30
32
|
|
31
33
|
TestNotifier.default_notifier = :growl
|
@@ -42,6 +44,7 @@ The available notifiers are <tt>:growl</tt>, <tt>:kdialog</tt>, <tt>:knotify</tt
|
|
42
44
|
* Steve Halasz - http://github.com/woodchuck
|
43
45
|
* Khaja Minhajuddin - http://minhajuddin.com/
|
44
46
|
* Steve Sloan - http://github.com/CodeMonkeySteve
|
47
|
+
* Jordan Byron - http://jordanbyron.com
|
45
48
|
|
46
49
|
== License
|
47
50
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "test_notifier"
|
2
|
+
require "minitest/unit"
|
3
|
+
|
4
|
+
MiniTest::Unit.after_tests do
|
5
|
+
runner = MiniTest::Unit.runner
|
6
|
+
|
7
|
+
stats = TestNotifier::Stats.new(:minitest, {
|
8
|
+
:count => runner.test_count,
|
9
|
+
:assertions => runner.assertion_count,
|
10
|
+
:failures => runner.failures,
|
11
|
+
:errors => runner.skips
|
12
|
+
})
|
13
|
+
|
14
|
+
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
15
|
+
end
|
data/lib/test_notifier/stats.rb
CHANGED
@@ -25,6 +25,16 @@ module TestNotifier
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def status_for_minitest
|
29
|
+
if options[:errors].nonzero?
|
30
|
+
:error
|
31
|
+
elsif options[:failures].nonzero?
|
32
|
+
:fail
|
33
|
+
else
|
34
|
+
:success
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
28
38
|
def status_for_test_unit
|
29
39
|
if options[:errors].nonzero?
|
30
40
|
:error
|
@@ -81,6 +91,15 @@ module TestNotifier
|
|
81
91
|
text.join(", ")
|
82
92
|
end
|
83
93
|
|
94
|
+
def message_for_minitest
|
95
|
+
text = []
|
96
|
+
text << "#{options[:count]} " + pluralize(options[:count], "test")
|
97
|
+
text << "#{options[:assertions]} " + pluralize(options[:assertions], "assertion")
|
98
|
+
text << "#{options[:failures]} failed" unless options[:failures].zero?
|
99
|
+
text << "#{options[:errors]} " + pluralize(options[:errors], "error") unless options[:errors].zero?
|
100
|
+
text.join(", ")
|
101
|
+
end
|
102
|
+
|
84
103
|
def pluralize(count, text)
|
85
104
|
count > 1 ? "#{text}s" : text
|
86
105
|
end
|
data/test/stats_test.rb
CHANGED
@@ -82,3 +82,29 @@ class TestNotifier::Stats::TestUnitTest < Test::Unit::TestCase
|
|
82
82
|
assert_equal "6 tests, 20 assertions, 2 failed, 3 errors", @stats.message
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
class TestNotifier::Stats::MiniTestTest < Test::Unit::TestCase
|
87
|
+
def setup
|
88
|
+
@stats = TestNotifier::Stats.new(:minitest)
|
89
|
+
end
|
90
|
+
|
91
|
+
test "success message" do
|
92
|
+
@stats.options = { :count => 10, :assertions => 20 }
|
93
|
+
assert_equal "10 tests, 20 assertions", @stats.message
|
94
|
+
end
|
95
|
+
|
96
|
+
test "message with failing examples" do
|
97
|
+
@stats.options = { :count => 10, :assertions => 20, :failures => 5 }
|
98
|
+
assert_equal "10 tests, 20 assertions, 5 failed", @stats.message
|
99
|
+
end
|
100
|
+
|
101
|
+
test "message with error examples" do
|
102
|
+
@stats.options = { :count => 10, :assertions => 20, :errors => 5 }
|
103
|
+
assert_equal "10 tests, 20 assertions, 5 errors", @stats.message
|
104
|
+
end
|
105
|
+
|
106
|
+
test "message with all types" do
|
107
|
+
@stats.options = { :count => 6, :failures => 2, :errors => 3, :assertions => 20 }
|
108
|
+
assert_equal "6 tests, 20 assertions, 2 failed, 3 errors", @stats.message
|
109
|
+
end
|
110
|
+
end
|
data/test_notifier.gemspec
CHANGED
metadata
CHANGED
@@ -1,76 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_notifier
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 6
|
9
|
-
version: 0.3.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Nando Vieira
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: notifier
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70228765010720 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: test-unit
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: *70228765010720
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: test-unit
|
27
|
+
requirement: &70228765009760 !ruby/object:Gem::Requirement
|
37
28
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
- 0
|
43
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
44
33
|
type: :development
|
45
|
-
|
46
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70228765009760
|
36
|
+
- !ruby/object:Gem::Dependency
|
47
37
|
name: mocha
|
38
|
+
requirement: &70228765008840 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
48
45
|
prerelease: false
|
49
|
-
|
46
|
+
version_requirements: *70228765008840
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70228765008280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
- 0
|
56
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
57
55
|
type: :development
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70228765008280
|
58
|
+
description: ! 'Display system notifications (dbus, growl and snarl) after
|
59
|
+
|
61
60
|
running tests. It works on Mac OS X, Linux and Windows. Powerful when used
|
61
|
+
|
62
62
|
with Autotest ZenTest gem for Rails apps.
|
63
63
|
|
64
|
-
|
64
|
+
'
|
65
|
+
email:
|
65
66
|
- fnando.vieira@gmail.com
|
66
67
|
executables: []
|
67
|
-
|
68
68
|
extensions: []
|
69
|
-
|
70
69
|
extra_rdoc_files: []
|
71
|
-
|
72
|
-
files:
|
70
|
+
files:
|
73
71
|
- .gitignore
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
74
|
- README.rdoc
|
75
75
|
- Rakefile
|
76
76
|
- lib/test_notifier.rb
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/test_notifier/rspec.rb
|
79
79
|
- lib/test_notifier/runner.rb
|
80
80
|
- lib/test_notifier/runner/autotest.rb
|
81
|
+
- lib/test_notifier/runner/minitest.rb
|
81
82
|
- lib/test_notifier/runner/rspec.rb
|
82
83
|
- lib/test_notifier/runner/spec.rb
|
83
84
|
- lib/test_notifier/runner/test_unit.rb
|
@@ -92,39 +93,37 @@ files:
|
|
92
93
|
- test/test_helper.rb
|
93
94
|
- test/test_notifier_test.rb
|
94
95
|
- test_notifier.gemspec
|
95
|
-
has_rdoc: true
|
96
96
|
homepage: http://rubygems.org/gems/test_notifier
|
97
97
|
licenses: []
|
98
|
-
|
99
98
|
post_install_message:
|
100
99
|
rdoc_options: []
|
101
|
-
|
102
|
-
require_paths:
|
100
|
+
require_paths:
|
103
101
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
103
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
segments:
|
110
109
|
- 0
|
111
|
-
|
112
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
hash: 2310303799204519241
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
112
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
segments:
|
118
118
|
- 0
|
119
|
-
|
119
|
+
hash: 2310303799204519241
|
120
120
|
requirements: []
|
121
|
-
|
122
121
|
rubyforge_project:
|
123
|
-
rubygems_version: 1.
|
122
|
+
rubygems_version: 1.8.6
|
124
123
|
signing_key:
|
125
124
|
specification_version: 3
|
126
125
|
summary: Display system notifications (dbus, growl and snarl) after running tests.
|
127
|
-
test_files:
|
126
|
+
test_files:
|
128
127
|
- test/stats_test.rb
|
129
128
|
- test/test_helper.rb
|
130
129
|
- test/test_notifier_test.rb
|