From: patrick-may@... (Patrick May) Date: 2002-08-08T21:06:16+09:00 Subject: Re: how do i mock the presence / absence of a constant w/out getting warnings? GOTO Kentaro wrote in message news:<200208080613.g786DGFI000424@miso.k.notwork.org>... > Though I'm not sure what your goal is, how about: > > (1) ignore that warning. > (2) do testing in different namespaces if it is possible. > (3) use Module#remove_const: > > class C > MOD_RUBY = true > remove_const :MOD_RUBY > MOD_RUBY = false > end This looks promising. > > (4) use a class variable instead of a constant in the product. > > > Hope this helps, > > -- Gotoken I am trying to write unit tested parsing code for a cgi module. Different parsing routines need to be run in different situations; the only reliable way to check whether MOD_RUBY is in use is to do if defined? MOD_RUBY or if MOD_RUBY. I have to be able to turn the constant on and off, b/c I have to test other parsing situations as well. ~ Patrick