I'm missing this particular feature in T::U that I have in RSpec -- nested contexts + lets/subjects blocks.
context "parent" do
subject { Factory(:something, :value => other_thing) }
let(:other_thing) { "Value" }
it "has 'Value' value" do
subject.value.should == "Value"
end
context "nested" do
let(:other_thing) { "Totally other value" }
it "has 'Totally other value' value" do
subject.value.should == 'Totally other value'
end
end
end
You might be interested in contest[1], which adds a thin layer of sugar over Test::Unit.
In addition to nested contexts, it also lets you provide your test name as a string rather than a method name, to avoid wearing out your underscore key with "def test_new_instance_should_respond_to_foo".
Exactly. I only alluded briefly to Shoulda (and Coulda) in my post. I live and die by them.
Context is king.
BTW, while I may beat up on RSpec, I learned much of how I perceive TDD indirectly from David Chelimsky. I may not be an RSpec fan any more but I'm a huge David fan.