test_notifier 0.3.4 → 0.3.5.rc.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -49,7 +49,7 @@ You can define your notifier.
49
49
 
50
50
  TestNotifier.default_notifier = :growl
51
51
 
52
- 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>.
52
+ 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></tt>.
53
53
 
54
54
  == Maintainer
55
55
 
@@ -7,7 +7,7 @@ module TestNotifier
7
7
  FILE = File.expand_path("~/.test_notifier-growl")
8
8
 
9
9
  def supported?
10
- RUBY_PLATFORM =~ /darwin/ && `ps -Al | grep GrowlHelper` && `which growlnotify` && $? == 0
10
+ RUBY_PLATFORM =~ /darwin/ && `ps -Al | grep GrowlHelper` && `which growlnotify` && $?.exitstatus == 0
11
11
  end
12
12
 
13
13
  def notify(options)
@@ -4,7 +4,7 @@ module TestNotifier
4
4
  extend self
5
5
 
6
6
  def supported?
7
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which kdialog &> /dev/null` && $? == 0
7
+ RUBY_PLATFORM =~ /(linux|freebsd)/ && `which kdialog &> /dev/null` && $?.exitstatus == 0
8
8
  end
9
9
 
10
10
  def notify(options)
@@ -4,7 +4,7 @@ module TestNotifier
4
4
  extend self
5
5
 
6
6
  def supported?
7
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `ps -Al | grep dcop` && $? == 0
7
+ RUBY_PLATFORM =~ /(linux|freebsd)/ && `ps -Al | grep dcop` && $?.exitstatus == 0
8
8
  end
9
9
 
10
10
  def notify(options)
@@ -4,7 +4,7 @@ module TestNotifier
4
4
  extend self
5
5
 
6
6
  def supported?
7
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which notify-send &> /dev/null` && $? == 0
7
+ RUBY_PLATFORM =~ /(linux|freebsd)/ && `which notify-send &> /dev/null` && $?.exitstatus == 0
8
8
  end
9
9
 
10
10
  def notify(options)
@@ -14,7 +14,7 @@ module TestNotifier
14
14
  }
15
15
 
16
16
  def supported?
17
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which osd_cat &> /dev/null` && $? == 0
17
+ RUBY_PLATFORM =~ /(linux|freebsd)/ && `which osd_cat &> /dev/null` && $?.exitstatus == 0
18
18
  end
19
19
 
20
20
  def notify(options)
@@ -0,0 +1,14 @@
1
+ module TestNotifier
2
+ module Notifier
3
+ module Placebo
4
+ extend self
5
+
6
+ def supported?
7
+ true
8
+ end
9
+
10
+ def notify(options)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -6,6 +6,7 @@ module TestNotifier
6
6
  autoload :Knotify, "test_notifier/notifier/knotify"
7
7
  autoload :Kdialog, "test_notifier/notifier/kdialog"
8
8
  autoload :NotifySend, "test_notifier/notifier/notify_send"
9
+ autoload :Placebo, "test_notifier/notifier/placebo"
9
10
 
10
11
  extend self
11
12
 
@@ -21,7 +22,7 @@ module TestNotifier
21
22
 
22
23
  def from_name(name)
23
24
  notifier = const_get(classify(name.to_s))
24
- rescue NameError
25
+ rescue Exception
25
26
  nil
26
27
  end
27
28
 
@@ -1,5 +1,5 @@
1
1
  require "test_notifier"
2
- require "rspec/core/formatters/base_text_formatter"
2
+ require "rspec/core/formatters"
3
3
 
4
4
  class RSpec::Core::Formatters::BaseTextFormatter
5
5
  alias dump_summary_original dump_summary
@@ -2,7 +2,7 @@ module TestNotifier
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 4
5
+ PATCH = 5
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/lib/test_notifier.rb CHANGED
@@ -6,7 +6,7 @@ module TestNotifier
6
6
 
7
7
  extend self
8
8
 
9
- class UnsupportedNotifierError < StandardError; end
9
+ NO_NOTIFIERS_MESSAGE = "[TEST NOTIFIER] You have no supported notifiers installed. Please read documentation."
10
10
 
11
11
  IMAGES = {
12
12
  :fail => File.dirname(__FILE__) + "/../resources/fail.png",
@@ -31,11 +31,11 @@ module TestNotifier
31
31
 
32
32
  def notifier
33
33
  self.__notifier__ ||= begin
34
- notifier = nil
35
- notifier = TestNotifier::Notifier.supported_notifier_from_name(default_notifier) if default_notifier
36
- notifier = TestNotifier::Notifier.supported_notifiers.first unless notifier
34
+ notifier = TestNotifier::Notifier.supported_notifier_from_name(default_notifier)
35
+ notifier ||= TestNotifier::Notifier.supported_notifiers.first
36
+
37
+ STDERR << NO_NOTIFIERS_MESSAGE if notifier == TestNotifier::Notifier::Placebo
37
38
 
38
- raise UnsupportedNotifierError, "You have no supported notifiers installed. Please read documentation." unless notifier
39
39
  notifier
40
40
  end
41
41
  end
@@ -13,7 +13,7 @@ class TestNotifier::NotifierTest < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  test "retrieve list of all notifiers" do
16
- assert_equal 6, TestNotifier::Notifier.notifiers.size
16
+ assert_equal 7, TestNotifier::Notifier.notifiers.size
17
17
  end
18
18
 
19
19
  test "return notifier by its name" do
@@ -20,10 +20,11 @@ class TestNotifierTest < Test::Unit::TestCase
20
20
  assert_equal TestNotifier::Notifier::Snarl, TestNotifier.notifier
21
21
  end
22
22
 
23
- test "raise error when there's no supported notifier" do
24
- assert_raise TestNotifier::UnsupportedNotifierError do
25
- TestNotifier.notifier
26
- end
23
+ test "output error message to $stderr when there's no supported notifier" do
24
+ STDERR.expects(:<<).with(TestNotifier::NO_NOTIFIERS_MESSAGE).once
25
+ TestNotifier::Notifier::Placebo.expects(:supported?).returns(true)
26
+ TestNotifier::Notifier::Placebo.expects(:notify).once
27
+ TestNotifier.notify :status => :fail, :message => "You have failed!"
27
28
  end
28
29
 
29
30
  test "send notification to supported notifier" do
metadata CHANGED
@@ -1,12 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_notifier
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ - rc
10
+ - 1
11
+ version: 0.3.5.rc.1
10
12
  platform: ruby
11
13
  authors:
12
14
  - Nando Vieira
@@ -14,7 +16,7 @@ autorequire:
14
16
  bindir: bin
15
17
  cert_chain: []
16
18
 
17
- date: 2010-09-09 00:00:00 -03:00
19
+ date: 2010-10-28 00:00:00 -02:00
18
20
  default_executable:
19
21
  dependencies: []
20
22
 
@@ -36,6 +38,7 @@ files:
36
38
  - lib/test_notifier/notifier/knotify.rb
37
39
  - lib/test_notifier/notifier/notify_send.rb
38
40
  - lib/test_notifier/notifier/osd_cat.rb
41
+ - lib/test_notifier/notifier/placebo.rb
39
42
  - lib/test_notifier/notifier/snarl.rb
40
43
  - lib/test_notifier/rspec.rb
41
44
  - lib/test_notifier/runner.rb
@@ -74,11 +77,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
77
  required_rubygems_version: !ruby/object:Gem::Requirement
75
78
  none: false
76
79
  requirements:
77
- - - ">="
80
+ - - ">"
78
81
  - !ruby/object:Gem::Version
79
82
  segments:
80
- - 0
81
- version: "0"
83
+ - 1
84
+ - 3
85
+ - 1
86
+ version: 1.3.1
82
87
  requirements:
83
88
  - You'll need Growl (Mac OS X), Libnotify, OSD or KDE (Linux) or Snarl (Windows)
84
89
  rubyforge_project: