But if I put the class attributes in the setup method, they are seen by
my test(s).
Is it normal practice to enter your class attributes in the setup
method?
A class that derives from Test::Unit::TestCase is still just a normal
class. Normal classes don't follow what you seem to expect of a
test_case derived class.
Consider...
class Foo @foo = 123
def bar
p @foo
end
end
Foo.new.bar
#=> nil
The instance of Foo that we create can't see the class instance
variable (@foo = 123).
You could change the bar method to..
p self.class.instance_variable_get(:@foo)
but I'd guess you don't want to do that.
Hope this helps,
Chris
···
On 9/21/06, aidy <aidy.rutter@gmail.com> wrote:
Hi,
I have a test class the inherits from Test::Unit::TestCase.
But if I put the class attributes in the setup method, they are seen by
my test(s).
Is it normal practice to enter your class attributes in the setup
method?