I tried to get this result:
Car.class.name # => "Car"
Truck.class.name # => "Truck"
Van.class.name # => "Van"
Car/Truck/Van.superclass.name # => "Vehicle"
I did this:
require "rspec/autorun"
class Vehicle
end
class Car < Vehicle
end
class Van < Vehicle
end
class Truck < Vehicle
end
describe Car do
describe ".class.name" do
it "returns name of the class" do
expect(Car.class.name).to eq "Car"
end
end
end
What am I missing about Ruby's class system in order to implement this?