Skip to content
Browse files

Fixed requires

... basically to satisfy 'test_deps' rake task
  • Loading branch information...
1 parent 8b3ccd4 commit dd19a56d0d411e18c08267727dea8a7d0f9c9f29 @argent-smith argent-smith committed Jan 25, 2012
View
7 test/autotest_notification/test_cygwin.rb
@@ -1,10 +1,11 @@
-require File.dirname(__FILE__) + '/../test_helper.rb'
+$:.unshift(File.expand_path('..', File.dirname(__FILE__)))
+require 'test_helper'
class TestCygwin < Test::Unit::TestCase
-
+
def test_notify
AutotestNotification::Cygwin.expects(:get_image_path).with("image").returns(" image ")
AutotestNotification::Cygwin.expects(:system).with('sncmd /m \'title\' \'msg\' \'image\' /t 3')
AutotestNotification::Cygwin.notify("title", "msg", "image")
end
-end
+end
View
183 test/autotest_notification/test_freebsd.rb
@@ -1,91 +1,92 @@
- require File.dirname(__FILE__) + '/../test_helper.rb'
-
- class TestFreeBSD < Test::Unit::TestCase
-
- def setup
- turn_methods_public AutotestNotification::FreeBSD
- AutotestNotification.const_set :DOOM_EDITION, false
- AutotestNotification.const_set :SPEAKING, false
- AutotestNotification.const_set :STICKY, false
- AutotestNotification.const_set :BUUF, false
- end
-
- def test_notify_when_use_notify_without_speak
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(true)
- verify_notify(:notify_send)
- end
-
- def test_notify_when_use_zenity_without_speak
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_zenity?).returns(true)
- verify_notify(:zenity)
- end
-
- def test_notify_when_use_kdialog_without_speak
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_zenity?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_kdialog?).returns(true)
- verify_notify(:kdialog)
- end
-
- def test_notify_when_use_notify_with_speak
- AutotestNotification.const_set :SPEAKING, true
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(true)
- AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
- verify_notify(:notify_send)
- end
-
- def test_notify_when_use_zenity_with_speak
- AutotestNotification.const_set :SPEAKING, true
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_zenity?).returns(true)
- AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
- verify_notify(:zenity)
- end
-
- def test_notify_when_use_kdialog_with_speak
- AutotestNotification.const_set :SPEAKING, true
- AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_zenity?).returns(false)
- AutotestNotification::FreeBSD.expects(:has_kdialog?).returns(true)
- AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
- verify_notify(:kdialog)
- end
-
- def test_notify_send
- AutotestNotification::FreeBSD.expects(:system).with('notify-send -h int:transient:1 -t 3000 -i image -u normal \'title\' \'msg\'')
- AutotestNotification::FreeBSD.notify_send("title", "msg", "image")
- end
-
- def test_notify_kdialog
- AutotestNotification::FreeBSD.expects(:system).with('kdialog --title \'title\' --passivepopup \'<img src="image" align="middle"> msg\' 3')
- AutotestNotification::FreeBSD.kdialog("title", "msg", "image")
- end
-
- def test_notify_zenity
- AutotestNotification::FreeBSD.expects(:system).with('zenity --info --text=\'msg\' --title=\'title\'')
- AutotestNotification::FreeBSD.zenity("title", "msg", "image")
- end
-
- def test_has_zenity?
- AutotestNotification::FreeBSD.expects(:system).with('which zenity > /dev/null 2>&1')
- AutotestNotification::FreeBSD.has_zenity?
- end
-
- def test_has_notify?
- AutotestNotification::FreeBSD.expects(:system).with('which notify-send > /dev/null 2>&1')
- AutotestNotification::FreeBSD.has_notify?
- end
-
- def test_has_kdialog?
- AutotestNotification::FreeBSD.expects(:system).with('which kdialog > /dev/null 2>&1')
- AutotestNotification::FreeBSD.has_kdialog?
- end
-
- private
-
- def verify_notify(method)
- AutotestNotification::FreeBSD.expects(method).returns("title", "msg", "image", 1)
- AutotestNotification::FreeBSD.notify("title", "msg", "image", 1, 1)
- end
- end
+$:.unshift(File.expand_path('..', File.dirname(__FILE__)))
+require 'test_helper'
+
+class TestFreeBSD < Test::Unit::TestCase
+
+ def setup
+ turn_methods_public AutotestNotification::FreeBSD
+ AutotestNotification.const_set :DOOM_EDITION, false
+ AutotestNotification.const_set :SPEAKING, false
+ AutotestNotification.const_set :STICKY, false
+ AutotestNotification.const_set :BUUF, false
+ end
+
+ def test_notify_when_use_notify_without_speak
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(true)
+ verify_notify(:notify_send)
+ end
+
+ def test_notify_when_use_zenity_without_speak
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_zenity?).returns(true)
+ verify_notify(:zenity)
+ end
+
+ def test_notify_when_use_kdialog_without_speak
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_zenity?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_kdialog?).returns(true)
+ verify_notify(:kdialog)
+ end
+
+ def test_notify_when_use_notify_with_speak
+ AutotestNotification.const_set :SPEAKING, true
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(true)
+ AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
+ verify_notify(:notify_send)
+ end
+
+ def test_notify_when_use_zenity_with_speak
+ AutotestNotification.const_set :SPEAKING, true
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_zenity?).returns(true)
+ AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
+ verify_notify(:zenity)
+ end
+
+ def test_notify_when_use_kdialog_with_speak
+ AutotestNotification.const_set :SPEAKING, true
+ AutotestNotification::FreeBSD.expects(:has_notify?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_zenity?).returns(false)
+ AutotestNotification::FreeBSD.expects(:has_kdialog?).returns(true)
+ AutotestNotification::FreeBSD.expects(:system).with("/usr/local/bin/espeak '1 test failed'")
+ verify_notify(:kdialog)
+ end
+
+ def test_notify_send
+ AutotestNotification::FreeBSD.expects(:system).with('notify-send -h int:transient:1 -t 3000 -i image -u normal \'title\' \'msg\'')
+ AutotestNotification::FreeBSD.notify_send("title", "msg", "image")
+ end
+
+ def test_notify_kdialog
+ AutotestNotification::FreeBSD.expects(:system).with('kdialog --title \'title\' --passivepopup \'<img src="image" align="middle"> msg\' 3')
+ AutotestNotification::FreeBSD.kdialog("title", "msg", "image")
+ end
+
+ def test_notify_zenity
+ AutotestNotification::FreeBSD.expects(:system).with('zenity --info --text=\'msg\' --title=\'title\'')
+ AutotestNotification::FreeBSD.zenity("title", "msg", "image")
+ end
+
+ def test_has_zenity?
+ AutotestNotification::FreeBSD.expects(:system).with('which zenity > /dev/null 2>&1')
+ AutotestNotification::FreeBSD.has_zenity?
+ end
+
+ def test_has_notify?
+ AutotestNotification::FreeBSD.expects(:system).with('which notify-send > /dev/null 2>&1')
+ AutotestNotification::FreeBSD.has_notify?
+ end
+
+ def test_has_kdialog?
+ AutotestNotification::FreeBSD.expects(:system).with('which kdialog > /dev/null 2>&1')
+ AutotestNotification::FreeBSD.has_kdialog?
+ end
+
+ private
+
+ def verify_notify(method)
+ AutotestNotification::FreeBSD.expects(method).returns("title", "msg", "image", 1)
+ AutotestNotification::FreeBSD.notify("title", "msg", "image", 1, 1)
+ end
+end
View
3 test/autotest_notification/test_linux.rb
@@ -1,4 +1,5 @@
-require File.dirname(__FILE__) + '/../test_helper.rb'
+$:.unshift(File.expand_path('..', File.dirname(__FILE__)))
+require 'test_helper'
class TestLinux < Test::Unit::TestCase
View
23 test/autotest_notification/test_mac.rb
@@ -1,7 +1,8 @@
-require File.dirname(__FILE__) + '/../test_helper.rb'
+$:.unshift(File.expand_path('..', File.dirname(__FILE__)))
+require 'test_helper'
class TestMac < Test::Unit::TestCase
-
+
def setup
AutotestNotification.const_set :DOOM_EDITION, false
AutotestNotification.const_set :SPEAKING, false
@@ -30,42 +31,42 @@ def test_notify_with_pending
AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' -t title")
AutotestNotification::Mac.notify("title", "msg", "image", 1)
end
-
+
def test_notify_with_sticky
AutotestNotification.const_set :STICKY, true
AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -s -p 0 -m 'msg' -t title")
AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
end
-
+
def test_success_sound_is_played_when_specified_and_test_success
- AutotestNotification.const_set :SUCCESS_SOUND, sound_path
+ AutotestNotification.const_set :SUCCESS_SOUND, sound_path
AutotestNotification::Mac.expects(:play).with(sound_path)
AutotestNotification::Mac.notify("title", "msg", "image", 1, 0)
end
-
+
def test_failure_sound_is_played_when_specified_and_tests_fail
AutotestNotification.const_set :FAILURE_SOUND, sound_path
AutotestNotification::Mac.expects(:play).with(sound_path)
AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
end
-
+
def test_failure_sound_is_not_played_when_tests_success
AutotestNotification.const_set :FAILURE_SOUND, sound_path
AutotestNotification::Mac.expects(:play).with(sound_path).times(0)
AutotestNotification::Mac.notify("title", "msg", "image", 1, 0)
end
-
+
def test_success_sound_is_not_played_when_tests_fail
AutotestNotification.const_set :SUCCESS_SOUND, sound_path
AutotestNotification::Mac.expects(:play).with(sound_path).times(0)
AutotestNotification::Mac.notify("title", "msg", "image", 1, 1)
end
-
+
def test_play_method_exists
# this should be testing if playsound is being called
assert_respond_to AutotestNotification::Mac, :play
end
-
+
def test_notify_with_buuf
AutotestNotification.const_set :BUUF, true
AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' -t title")
@@ -75,4 +76,4 @@ def test_notify_with_buuf
def sound_path
"#{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/1.wav"
-end
+end
View
7 test/autotest_notification/test_windows.rb
@@ -1,12 +1,13 @@
-require File.dirname(__FILE__) + '/../test_helper.rb'
+$:.unshift(File.expand_path('..', File.dirname(__FILE__)))
+require 'test_helper'
class Snarl
end
class TestWindows < Test::Unit::TestCase
-
+
def test_notify
Snarl.expects(:show_message).with("title", "msg", "image")
AutotestNotification::Windows.notify("title", "msg", "image")
end
-end
+end
View
3 test/test_autotest_notification.rb
@@ -1,4 +1,5 @@
-require File.dirname(__FILE__) + '/test_helper.rb'
+$:.unshift(File.expand_path('.', File.dirname(__FILE__)))
+require 'test_helper'
class TestAutotestNotification < Test::Unit::TestCase
View
4 test/test_helper.rb
@@ -1,8 +1,10 @@
+$:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
+
require "test/unit"
require "rubygems"
require 'autotest'
require "mocha"
-require File.dirname(__FILE__) + '/../lib/autotest_notification' unless defined?(AutotestNotification)
+require 'autotest_notification' unless defined?(AutotestNotification)
class Test::Unit::TestCase
def turn_methods_public(classe, method_name = nil)

0 comments on commit dd19a56

Please sign in to comment.
Something went wrong with that request. Please try again.