test_notifier 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +17 -13
- data/lib/test_notifier/runner/rspec.rb +5 -27
- data/lib/test_notifier/runner/rspec2.rb +29 -0
- data/lib/test_notifier/runner/rspec3.rb +32 -0
- data/lib/test_notifier/version.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/test_notifier_spec.rb +10 -13
- data/test_notifier.gemspec +1 -1
- metadata +28 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 53190d3381ccc6d8489e46f9c23a9f33adfe17ed
|
4
|
+
data.tar.gz: 033dc4ec9db032625d609b1395ed306e22749d4b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b6e078f0d03822377993de808d33ad0d59652b8efa97e5c2686bcc18565d4bc17f104182b740d7f3ec61d9c6205dd1ba39d0281495b989ed2c802ab35b2012dd
|
7
|
+
data.tar.gz: 6a09a75d4a4fdb823aa49323fe03fe5cd41250ad629efbcba4318e25e035f6ca4b89b8811316a67a61c46623370563afd543e282e1efcf0245b789d58a36662c
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source "http://rubygems.org"
|
2
2
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
test_notifier (
|
4
|
+
test_notifier (2.0.0)
|
5
5
|
notifier
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.
|
11
|
-
notifier (0.
|
12
|
-
rake (
|
13
|
-
rspec (
|
14
|
-
rspec-core (
|
15
|
-
rspec-expectations (
|
16
|
-
rspec-mocks (
|
17
|
-
rspec-core (
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
notifier (0.4.1)
|
12
|
+
rake (10.2.2)
|
13
|
+
rspec (3.0.0.beta2)
|
14
|
+
rspec-core (= 3.0.0.beta2)
|
15
|
+
rspec-expectations (= 3.0.0.beta2)
|
16
|
+
rspec-mocks (= 3.0.0.beta2)
|
17
|
+
rspec-core (3.0.0.beta2)
|
18
|
+
rspec-support (= 3.0.0.beta2)
|
19
|
+
rspec-expectations (3.0.0.beta2)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (= 3.0.0.beta2)
|
22
|
+
rspec-mocks (3.0.0.beta2)
|
23
|
+
rspec-support (= 3.0.0.beta2)
|
24
|
+
rspec-support (3.0.0.beta2)
|
21
25
|
|
22
26
|
PLATFORMS
|
23
27
|
ruby
|
24
28
|
|
25
29
|
DEPENDENCIES
|
26
30
|
rake
|
27
|
-
rspec
|
31
|
+
rspec (>= 3.0.0.beta2)
|
28
32
|
test_notifier!
|
@@ -1,29 +1,7 @@
|
|
1
|
-
require "
|
2
|
-
require "rspec/core/formatters/base_text_formatter"
|
1
|
+
require "rspec/core/version"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
3
|
+
if RSpec::Core::Version::STRING >= "3.0.0"
|
4
|
+
require "test_notifier/runner/rspec3"
|
5
|
+
else
|
6
|
+
require "test_notifier/runner/rspec2"
|
29
7
|
end
|
@@ -0,0 +1,29 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
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(options)
|
8
|
+
dump_summary_original(options)
|
9
|
+
example_count = options[:example_count]
|
10
|
+
failure_count = options[:failure_count]
|
11
|
+
pending_count = options[:pending_count]
|
12
|
+
|
13
|
+
return if example_count.zero?
|
14
|
+
|
15
|
+
failure_filter = proc {|e|
|
16
|
+
e.instance_variable_get("@exception").class.name == "RSpec::Expectations::ExpectationNotMetError"
|
17
|
+
}
|
18
|
+
|
19
|
+
error_filter = proc {|e|
|
20
|
+
%w[RSpec::Expectations::ExpectationNotMetError NilClass].include?(e.instance_variable_get("@exception").class.name)
|
21
|
+
}
|
22
|
+
|
23
|
+
stats = TestNotifier::Stats.new(:rspec, {
|
24
|
+
:count => example_count,
|
25
|
+
:failures => examples.select(&failure_filter).count,
|
26
|
+
:pending => pending_count,
|
27
|
+
:errors => examples.reject(&error_filter).count
|
28
|
+
})
|
29
|
+
|
30
|
+
TestNotifier.notify(:status => stats.status, :message => stats.message)
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@ require "test_notifier"
|
|
3
3
|
module SpecHelpers
|
4
4
|
def unsupport_all_notifiers
|
5
5
|
Notifier.notifiers.each do |notifier|
|
6
|
-
notifier.
|
6
|
+
allow(notifier).to receive(:supported?).and_return(false) unless notifier == Notifier::Placebo
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/spec/test_notifier_spec.rb
CHANGED
@@ -4,19 +4,16 @@ describe TestNotifier do
|
|
4
4
|
before { unsupport_all_notifiers }
|
5
5
|
|
6
6
|
it "uses default notifier" do
|
7
|
-
Notifier::Growl.
|
8
|
-
Notifier::Snarl.
|
7
|
+
allow(Notifier::Growl).to receive(:supported?).and_return(true)
|
8
|
+
allow(Notifier::Snarl).to receive(:supported?).and_return(true)
|
9
9
|
TestNotifier.default_notifier = :snarl
|
10
10
|
|
11
11
|
expect(TestNotifier.notifier).to eql(Notifier::Snarl)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "outputs error message to $stderr when there's no supported notifier" do
|
15
|
-
STDERR
|
16
|
-
|
17
|
-
.with(TestNotifier::NO_NOTIFIERS_MESSAGE)
|
18
|
-
|
19
|
-
Notifier::Placebo.should_receive(:notify)
|
15
|
+
expect(STDERR).to receive(:<<).with(TestNotifier::NO_NOTIFIERS_MESSAGE)
|
16
|
+
expect(Notifier::Placebo).to receive(:notify)
|
20
17
|
|
21
18
|
TestNotifier.notify :status => :fail, :message => "You have failed!"
|
22
19
|
end
|
@@ -24,8 +21,8 @@ describe TestNotifier do
|
|
24
21
|
it "outputs error message won't display when silence_no_notifier_warning is true" do
|
25
22
|
TestNotifier.silence_no_notifier_warning = true
|
26
23
|
|
27
|
-
STDERR.
|
28
|
-
Notifier::Placebo.
|
24
|
+
expect(STDERR).not_to receive(:<<)
|
25
|
+
expect(Notifier::Placebo).to receive(:notify)
|
29
26
|
|
30
27
|
TestNotifier.notify :status => :fail, :message => "You have failed!"
|
31
28
|
end
|
@@ -33,15 +30,15 @@ describe TestNotifier do
|
|
33
30
|
it "outputs error message won't display when silence_no_notifier_warning is true" do
|
34
31
|
TestNotifier.silence_no_notifier_warning = true
|
35
32
|
|
36
|
-
STDERR.
|
37
|
-
Notifier::Placebo.
|
33
|
+
expect(STDERR).not_to receive(:<<)
|
34
|
+
expect(Notifier::Placebo).to receive(:notify)
|
38
35
|
|
39
36
|
TestNotifier.notify :status => :fail, :message => "You have failed!"
|
40
37
|
end
|
41
38
|
|
42
39
|
it "sends notification to supported notifier" do
|
43
|
-
Notifier::Snarl.
|
44
|
-
Notifier::Snarl.
|
40
|
+
allow(Notifier::Snarl).to receive(:supported?).and_return(true)
|
41
|
+
expect(Notifier::Snarl).to receive(:notify).with({
|
45
42
|
:status => :fail,
|
46
43
|
:message => "You have failed!",
|
47
44
|
:title => TestNotifier::TITLES[:fail],
|
data/test_notifier.gemspec
CHANGED
metadata
CHANGED
@@ -1,79 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nando Vieira
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: notifier
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 3.0.0.beta2
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 3.0.0.beta2
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
|
-
description:
|
63
|
-
|
55
|
+
description: |
|
56
|
+
Display system notifications (dbus, growl and snarl) after
|
64
57
|
running tests. It works on Mac OS X, Linux and Windows. Powerful when used
|
65
|
-
|
66
58
|
with Autotest ZenTest gem and alike for Rails apps.
|
67
|
-
|
68
|
-
'
|
69
59
|
email:
|
70
60
|
- fnando.vieira@gmail.com
|
71
61
|
executables: []
|
72
62
|
extensions: []
|
73
63
|
extra_rdoc_files: []
|
74
64
|
files:
|
75
|
-
- .gitignore
|
76
|
-
- .rspec
|
65
|
+
- ".gitignore"
|
66
|
+
- ".rspec"
|
77
67
|
- Gemfile
|
78
68
|
- Gemfile.lock
|
79
69
|
- README.rdoc
|
@@ -83,6 +73,8 @@ files:
|
|
83
73
|
- lib/test_notifier/runner/autotest.rb
|
84
74
|
- lib/test_notifier/runner/minitest.rb
|
85
75
|
- lib/test_notifier/runner/rspec.rb
|
76
|
+
- lib/test_notifier/runner/rspec2.rb
|
77
|
+
- lib/test_notifier/runner/rspec3.rb
|
86
78
|
- lib/test_notifier/runner/spec.rb
|
87
79
|
- lib/test_notifier/runner/test_unit.rb
|
88
80
|
- lib/test_notifier/stats.rb
|
@@ -100,26 +92,31 @@ files:
|
|
100
92
|
- test_notifier.gemspec
|
101
93
|
homepage: http://rubygems.org/gems/test_notifier
|
102
94
|
licenses: []
|
95
|
+
metadata: {}
|
103
96
|
post_install_message:
|
104
97
|
rdoc_options: []
|
105
98
|
require_paths:
|
106
99
|
- lib
|
107
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
101
|
requirements:
|
110
|
-
- -
|
102
|
+
- - ">="
|
111
103
|
- !ruby/object:Gem::Version
|
112
104
|
version: '0'
|
113
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
106
|
requirements:
|
116
|
-
- -
|
107
|
+
- - ">="
|
117
108
|
- !ruby/object:Gem::Version
|
118
109
|
version: '0'
|
119
110
|
requirements: []
|
120
111
|
rubyforge_project:
|
121
|
-
rubygems_version:
|
112
|
+
rubygems_version: 2.2.2
|
122
113
|
signing_key:
|
123
|
-
specification_version:
|
114
|
+
specification_version: 4
|
124
115
|
summary: Display system notifications (dbus, growl and snarl) after running tests.
|
125
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- spec/spec_helper.rb
|
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
|