def add_two(number = 0, *rest) return nil unless number.respond_to? :+ # if number.respond_to? :+ if number.respond_to? :concat puts "srsly?" if rest.size > 0 if number.respond_to? :push number.push 2 else number.concat "2" end else rest << number rest_sum = 0 rest.each do |num| rest_sum += num end 2 + rest_sum end # end end def add_five number # … end def test_add_two p add_two(2) == 4 p add_two(1) == 3 p add_two(1.0) == 3.0 p add_two("a") == "a2" p add_two([]) == [2] p add_two([1]) == [1,2] p add_two({}) == nil p add_two(nil) == nil p add_two(true) == nil p add_two == 2 p add_two(1,2) == 5 p add_two("a", "b") end def test_add_five # test with expectation for add_five end def test_all test_add_two test_add_five end test_all