This isn't specific to RSpec, but is hopefully on-topic for this list. I like (especially when "ping pong pairing") to write a spec, then write the smallest amount of code I can to pass it (especially when "ping pong pairing"). Sometimes this means hard-coding a return value, which means another spec is needed to prove that the code is really behaving as it should. Trivial example:
---------- describe Adder do it "should add two numbers" do Adder.add(2, 2).should == 4 end end class Adder def add a, b 4 end end ---------- describe Adder do it "should add 2 and 2" do Adder.add(2, 2).should == 4 end it "should add 3 and 4" do Adder.add(3, 4).should == 7 end end class Adder def add a, b a + b end end ---------- It doesn't seem right though to have all those duplicate specs. An alternative is to generate random test data, but I'm not really comfortable doing that because it means the tests aren't strictly repeatable. I guess this is more of a problem with classic state-based testing, but even using BDD you still have to test state at the leaf nodes. Does anyone have an opinion about whether this is a problem, and whether there's a clean way of dealing with it? Thanks, Kerry _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users