refactored problem 4 and changed tests from minitest to rspec