test/test_process.rb in god-0.13.2 vs test/test_process.rb in god-0.13.3
- old
+ new
@@ -57,12 +57,14 @@
end
def test_valid_should_return_true_if_gid_exists
@p.start = 'qux'
@p.log = '/tmp/foo.log'
- @p.gid = 'wheel'
+ @p.gid = Etc.getgrgid(::Process.gid).name
+ ::Process.stubs(:groups=)
+
assert @p.valid?
end
def test_valid_should_return_false_if_gid_does_not_exists
@p.start = 'qux'
@@ -102,15 +104,19 @@
assert !@p.valid?
end
def test_valid_should_return_true_with_chroot_and_valid_log
@p.start = 'qux'
- @p.chroot = '/tmp'
- @p.log = '/tmp/foo.log'
+ @p.chroot = Dir.pwd
+ @p.log = "#{@p.chroot}/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)
+ File.expects(:exist?).with(@p.chroot).returns(true)
+ File.expects(:exist?).with(@p.log).returns(true)
+ File.expects(:exist?).with("#{@p.chroot}/dev/null").returns(true)
+
+ File.stubs(:writable?).with('/foo.log').returns(true)
+
+ ::Dir.stubs(:chroot)
assert @p.valid?
end
# call_action