Specs: spec/dessert_spec.rb
Skeleton: lib/dessert.rb
-
Create a class Dessert with getters and setters for name and calories. The constructor should accept arguments for name and calories.
-
Define instance methods
healthy?
, which returns true iff a dessert has less than 200 calories, anddelicious?
, which returns true for all desserts. -
Create a class JellyBean that inherits from Dessert. The constructor should accept a single argument giving the jelly bean's flavor; a newly-created jelly bean should have 5 calories and its name should be the flavor plus "jelly bean", for example, "strawberry jelly bean".
-
Add a getter and setter for the flavor.
-
Modify
delicious?
to return false if the flavor islicorice
, but true for all other flavors. The behavior ofdelicious?
for non-jelly-bean desserts should be unchanged.