From: Nick Sieger Date: 2007-01-25T06:09:47+09:00 Subject: Re: test/spec -- was Re: I don't get rspec ------=_Part_6390_31323996.1169672979501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/24/07, Christian Neukirchen wrote: > > > > > If it's just a matter of namespacing for reporting/organization that's > > kind of interesting. > > I'm not sure how I could implement that (and I wont ;-)). But maybe > includable setups would be useful. > > module UserSetup > setup do # ??? > @user = User.new > end > end It's actually pretty easy if you don't mind using the Module#included hook. module UserSetup def self.included(context) context.setup do @user = User.new end end end But I'm sure you would have figured that out eventually... :) context "Users" do > context "with a valid email address" do > include UserSetup > setup { @user.email ... } > end > context "with a valid email address" do > include UserSetup > setup { @user.email ... } > end > end Cheers, /Nick ------=_Part_6390_31323996.1169672979501--