I need some help with some TDD concepts. Say I have the following code
def execute(command)
case command
when "c"
create_new_character
when "i"
display_inventory
end
end
def create_new_character
# do stuff to create new character
end
def display_inventory
# do stuff to display inventory
end
Now I'm not sure what to write my unit tests for. If I write unit tests for the execute
method doesn't that pretty much cover my tests for create_new_character
and display_inventory
? Or am I testing the wrong stuff at that point? Should my test for the execute
method only test that execution is passed off to the correct methods and stop there? Then should I write more unit tests that specifically test create_new_character
and display_inventory
?