From: Christian Neukirchen Date: 2007-01-24T05:06:30+09:00 Subject: Re: test/spec -- was Re: I don't get rspec Joel VanderWerf writes: > I like the continuity with test/unit. I'd be more likely to use this > than rspec for my older projects. > > Questions (from a BDD newbie): > > Are the context and specify argument strings purely documentation, or > do they need to be class or method names? They can contain anything except NUL bytes (the extended symbol syntax). They are turned into class and method names automatically (we need some special formatting for that due to Test::Unit restrictions). > Is it possible to nest contexts? Is this a good idea? test/spec allows them since 0.2, and I use them to group contexts that go together. Note that nothing is inherited, it's purely namespacing. RSpec doesn't have them, and they aren't interesting in implementing them AFAICT. > Inside of a context, is there a setup/teardown protocol as there is in > test/unit? Yes, you can use context "Blah" do setup do @blah = Blah.new end teardown do @blah.destroy! end end You can have multiple of these, and they are run in order of appearance. -- Christian Neukirchen http://chneukirchen.org