1 require File.join(File.dirname(__FILE__), *%w[.. lib god])
8 if RUBY_PLATFORM =~ /linux/i && Process.uid != 0
10 *********************************************************************
12 * You need to run these tests as root (netlink requires it) *
14 *********************************************************************
26 abort "=> You need the Mocha gem to run these tests."
32 class FakeCondition < Condition
38 class FakePollCondition < PollCondition
44 class FakeEventCondition < EventCondition
53 class FakeBehavior < Behavior
64 class FakeContact < Contact
72 alias :at_exit_orig :at_exit
86 self.pid_file_directory = nil
92 old_verbose, $VERBOSE = $VERBOSE, nil
95 $VERBOSE = old_verbose
99 old_stdout = $stdout.dup
100 $stdout.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
102 $stdout.reopen(old_stdout)
106 old_stderr = $stderr.dup
107 $stderr.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
109 $stderr.reopen(old_stderr)
118 module Test::Unit::Assertions
120 assert_raise SystemExit do
128 # This allows you to be a good OOP citizen and honor encapsulation, but
129 # still make calls to private methods (for testing) by doing
131 # obj.bypass.private_thingie(arg1, arg2)
133 # Which is easier on the eye than
135 # obj.send(:private_thingie, arg1, arg2)
139 instance_methods.each do |m|
140 undef_method m unless m =~ /^__/
147 def method_missing(sym, *args)
148 @ref.__send__(sym, *args)