On Mar 23, 3:02=A0pm, Brian Candler <b.cand... / pobox.com> wrote:
> Luke St.Clair wrote:
> > Is there some way to:
> > 1) set a global variable in the "parent" test suite that the children
> > see? =A0Seems like the answer to this is no
>
> Shoulda sits on top of Test::Unit and may be helpful. Something like
> this:
>
> class MyTest < Test::Unit::TestCase
> =A0 context "top level" do
> =A0 =A0 setup do
> =A0 =A0 =A0 @stuff =3D ...
> =A0 =A0 end
>
> =A0 =A0 should "test something at top level" do
> =A0 =A0 =A0 assert_equal 123, @stuff.size
> =A0 =A0 end
>
> =A0 =A0 context "inner level" do
> =A0 =A0 =A0 setup do
> =A0 =A0 =A0 =A0 @more_stuff =3D ...
> =A0 =A0 =A0 end
>
> =A0 =A0 =A0 should "test more" do
> =A0 =A0 =A0 =A0 assert_equal @stuff.size, @more_stuff.size
> =A0 =A0 =A0 end
> =A0 =A0 end
> =A0 end
> end


This seems incredibly useful - unfortunately, I can't use shoulda.