test/test_process.rb in god-0.7.7 vs test/test_process.rb in god-0.7.8
- old
+ new
@@ -66,21 +66,43 @@
@p.gid = 'wheel'
assert @p.valid?
end
- def test_valid_should_return_true_if_gid_does_not_exists
+ def test_valid_should_return_false_if_gid_does_not_exists
@p.start = 'qux'
@p.log = '/tmp/foo.log'
@p.gid = 'foobarbaz'
no_stdout do
no_stderr do
assert !@p.valid?
end
end
end
+
+ def test_valid_should_return_false_with_bogus_chroot
+ @p.chroot = '/bogusroot'
+
+ no_stdout do
+ no_stderr do
+ assert !@p.valid?
+ end
+ end
+ end
+
+ def test_valid_should_return_true_with_chroot_and_valid_log
+ @p.start = 'qux'
+ @p.chroot = '/tmp'
+ @p.log = '/tmp/foo.log'
+
+ File.expects(:exist?).with('/tmp').returns(true)
+ File.expects(:exist?).with('/tmp/foo.log').returns(true)
+ File.expects(:exist?).with('/tmp/dev/null').returns(true)
+
+ assert @p.valid?
+ end
# call_action
def test_call_action_should_write_pid
# Only for start, restart
@@ -170,16 +192,23 @@
File.stubs(:read).returns("246")
assert_equal 246, @p.pid
end
- # defaul_pid_file
+ # default_pid_file
def test_default_pid_file
assert_equal File.join(God.pid_file_directory, 'foo.pid'), @p.default_pid_file
end
+ # unix socket
+
+ def test_unix_socket_should_return_path_specified
+ @p.unix_socket = '/path/to-socket'
+ assert_equal '/path/to-socket', @p.unix_socket
+ end
+
# call_action
# These actually excercise call_action in the back at this point - Kev
def test_call_action_with_string_should_call_system
@p.start = "do something"
@@ -212,6 +241,6 @@
[:start, :stop, :restart].each do |x|
@p.expects(:call_action).with(x)
@p.send("#{x}!")
end
end
-end
\ No newline at end of file
+end