I have something like this:
class Vehicle
def self.set_color(input)
if %w{blue red green}.include?(input)
input
else
raise "Bad color"
end
end
end
class Car < Vehicle
def make_car
begin
my_color = Vehicle.set_color("orange")
rescue
puts "you screwed the pooch"
end
end
end
class CarTest < Test::Unit::TestCase
def test_number_one
c = Car.new
c.make_car
end
end
But for some reason, my test is raising the exception and stopping execution instead of catching it and outputting "you screwed the pooch." Any idea why this is happening and how to fix it?
Thanks!