riot_notifier 0.0.7 → 0.0.8

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.
data/.watchr CHANGED
@@ -1,21 +1,15 @@
1
-
2
- def run(*args)
3
- system "ruby -rubygems -Ilib:test #{args.join(' ')}"
4
- end
5
-
6
- def run_tests
7
- system "rake test"
8
- end
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') {|md| run "test/test_#{underscore(md[1])}.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
@@ -55,5 +55,4 @@ like libnotify.
55
55
  * Peter Suschlik
56
56
 
57
57
  == TODO
58
- * riot's assertions support blocks! (like asserts_topic.equals { topic }). Use it!
59
- * Test auto-detection and Libnotify
58
+ * Test Libnotify
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  gem.has_rdoc = true
13
13
  gem.extra_rdoc_files = [ "README.rdoc" ]
14
14
 
15
- gem.add_dependency "riot", ">= 0.10.9"
15
+ gem.add_dependency "riot", ">= 0.10.11"
16
16
  gem.add_development_dependency "riot_notifier"
17
17
  gem.add_development_dependency "libnotify"
18
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -26,7 +26,7 @@ module RiotNotifier
26
26
  end
27
27
 
28
28
  def self.inherited(notifier)
29
- ::RiotNotifier.order.unshift notifier
29
+ ::RiotNotifier.register notifier
30
30
  end
31
31
 
32
32
  # Override
@@ -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
@@ -11,10 +11,53 @@ class MockNotifier < ::RiotNotifier::None
11
11
  [ color, msg ]
12
12
  end
13
13
 
14
- ::RiotNotifier.order.delete(self)
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.7
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: 2009-12-17 00:00:00 +01:00
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.9
23
+ version: 0.10.11
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: riot_notifier