Improving software delivery in every organisation

Triangulation

Given a method f which has the production code as follows:

def eat_cake(cake)
  unwrap(cake)
  eat(cake)
end

When TDDing you need at least 2 tests to be confident that your method hasn’t been slimed. With only 1 test you can pass the test by hard coding the tested value. E.g.

def test_eating_cake_eats_carrot_cake
  eat_cake(:carrot_cake)
  expect(eat).called_with :carrot_cake
end

def eat_cake(cake)
  eat(:carrot_cake)
end

Marking scheme