I'm having a really odd thing happen with two files that mutually
require each other, and I'm hoping for help.

I have a file of code and a corresponding file of tests. They have the
same main program, which is to run the tests (unless there's something
in the args, as usual).

So I set up the code file to require the tests file and the tests file
to require the code file.

It turns out that, if I start to run, say, the code, Ruby will

begin code
	code requires tests:
	begin tests
		tests requires code:
		begin code
			code requires tests:
			tests load = false
		end code
		defining code classes ****
		code load = true
	end tests
	defining test classes
	tests load = true
end code
defining code classes ****

The above is an actual printout from the program, except that I manually
tabbed it to make it easier to read.

Note that the code classes are defined twice. If I do it the other way
around, running the test file, then it happens the other way around: the
tests are loaded twice and the test files defined twice.

Either way it's weird. Worst of all, the program runs differently
depending which file I load first.

So ... any advice will be very welcome. What am I missing?

Thanks,

Ronald E Jeffries
http://www.XProgramming.com
http://www.objectmentor.com
I'm giving the best advice I have. You get to decide whether it's true for you.