rspec testing for iterative and recursive solutions