one path hits all the code but is that 100%?

rspec_for_rails is a fantastic plugin and makes rcov easy to use. i came across an interesting case. given this code to describe a person in a mostly American population.

class Person def leader leader = President.new #default case if self.nationality == :british #exception leader = PrimeMinister.new end return leader end end /typo:code

an rspec of the following will test all lines of code describe Person do it "should identify the political leader" person = Person.new person.nationality = :british person.leader.is_a?(PrimeMinister).should be_true end end /typo:code

that executes every line of code but is it enough? should there be a second test for when the nationality is not :british?

tags: