From: Gennady Date: 2003-04-02T03:51:20+09:00 Subject: Re: sharing objects between tests (revisited?) ----- Original Message ----- From: "Paul Brannan" To: "ruby-talk ML" Sent: Tuesday, April 01, 2003 10:35 AM Subject: sharing objects between tests (revisited?) > I don't know if I've asked this on this list before or only on irc (I > can't find an earlier post on the subject, so I appologize if I'm asking > this a second time; I don't remember the answer). > > I have a number of tests that create some object. The tests are not > unit tests, but I am using a unit test framework (RUNIT or Test::Unit) > to write the tests. This object is expensive (time-wise) to create, and > I would like to share the object between my tests. If I write this: > > class MyTest < Test::Unit::TestCase > def setup > @f = Foo.new How about @f ||= Foo.new > end > > def test_1 > end > > def test_2 > end > end > > --- Gennady.