riot_notifier 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.watchr +9 -15
- data/README.rdoc +1 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/riot_notifier/base.rb +1 -1
- data/lib/riot_notifier/module.rb +12 -0
- data/test/test_riot_notifier.rb +44 -1
- metadata +3 -3
data/.watchr
CHANGED
@@ -1,21 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def underscore(file)
|
11
|
-
file.gsub('/', '_')
|
1
|
+
#!/usr/bin/env watchr
|
2
|
+
|
3
|
+
begin
|
4
|
+
require File.join(ENV["HOME"], ".watchr.test.rb")
|
5
|
+
rescue LoadError
|
6
|
+
warn "Unable to load #{File.join(ENV["HOME"], ".watchr.test.rb")}"
|
7
|
+
warn "You might try this: http://gist.github.com/raw/273574/8804dff44b104e9b8706826dc8882ed985b4fd13/.watchr.test.rb"
|
8
|
+
exit
|
12
9
|
end
|
13
10
|
|
14
11
|
watch('test/test_.*\.rb') {|md| run md[0] }
|
15
|
-
watch('lib/(.*)\.rb') {
|
12
|
+
watch('lib/(.*)\.rb') { run_tests }
|
16
13
|
watch('test/helper.rb') { run_tests }
|
17
14
|
|
18
15
|
run_tests
|
19
|
-
|
20
|
-
Signal.trap("QUIT") { abort("\n") }
|
21
|
-
Signal.trap("INT") { run_tests }
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/lib/riot_notifier/base.rb
CHANGED
data/lib/riot_notifier/module.rb
CHANGED
@@ -16,6 +16,18 @@ module RiotNotifier
|
|
16
16
|
notifier_class.new(*args, &block)
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.register(notifier)
|
20
|
+
order.unshift notifier
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.unregister(notifier)
|
24
|
+
order.delete notifier
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.unregister_all
|
28
|
+
order.clear
|
29
|
+
end
|
30
|
+
|
19
31
|
def self.order
|
20
32
|
@order ||= []
|
21
33
|
end
|
data/test/test_riot_notifier.rb
CHANGED
@@ -11,10 +11,53 @@ class MockNotifier < ::RiotNotifier::None
|
|
11
11
|
[ color, msg ]
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
RiotNotifier.unregister(self)
|
15
15
|
end
|
16
16
|
|
17
17
|
context "RiotNotifier" do
|
18
|
+
context "module" do
|
19
|
+
setup do
|
20
|
+
RiotNotifier.unregister_all
|
21
|
+
RiotNotifier
|
22
|
+
end
|
23
|
+
|
24
|
+
asserts("empty order") { topic.order }.equals([])
|
25
|
+
asserts("fallback") { topic.new }.kind_of(RiotNotifier::None)
|
26
|
+
|
27
|
+
context "subclassing base" do
|
28
|
+
hookup do
|
29
|
+
Class.new(RiotNotifier::Base) do
|
30
|
+
def self.usable?
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.name
|
35
|
+
:usable
|
36
|
+
end
|
37
|
+
end
|
38
|
+
Class.new(RiotNotifier::Base) do
|
39
|
+
def self.usable?
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.name
|
44
|
+
:unusable
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
asserts("order") { topic.order.size }.equals(2)
|
50
|
+
asserts("first notifier is unusable") { !topic.order.first.usable? }
|
51
|
+
asserts("last notifier is usable") { topic.order.last.usable? }
|
52
|
+
asserts("usable notifier is") { topic.new.class.name }.equals(:usable)
|
53
|
+
asserts("after unregistering notifier order") do
|
54
|
+
topic.unregister topic.order.last
|
55
|
+
topic.order.size
|
56
|
+
end.equals(1)
|
57
|
+
asserts("fallback") { topic.new }.kind_of(RiotNotifier::None)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
18
61
|
context "with MockNotifier" do
|
19
62
|
setup do
|
20
63
|
reporter = MockNotifier.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riot_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Suschlik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-13 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.10.
|
23
|
+
version: 0.10.11
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: riot_notifier
|