News for hackers. Stuff that matters.
Re:Ruby Test::Unit sucks (and why I still use it) by xentronium on Sunday December 19, 2010 @03:02AM (#2021361)
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
Re:Ruby Test::Unit sucks (and why I still use it) by phiggy on Sunday December 19, 2010 @04:40PM (#2022584)
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".

[1] https://github.com/citrusbyte/contest/blob/master/lib/contes...

Re:Ruby Test::Unit sucks (and why I still use it) by nborgo on Sunday December 19, 2010 @11:10AM (#2021868)
Have you looked at Shoulda? It lets you use contexts and adds to the goodness of Test::Unit at the same time.
Re:Ruby Test::Unit sucks (and why I still use it) by sleight42 on Monday December 20, 2010 @08:34AM (#2024219)
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.