In this exercise, you'll see that there is a method in the PhonePlan
class that calculates the cost of a plan differently depending on its type. However, the class should only know how to retrieve the cost, not the details of how to calculate it.
To start, you'll want to fork this repo and run the setup script
cd tech-exercise
bin/setup
Open up lib/phone_plan.rb
. There you will see a single method named cost
. Its corresponding tests are in spec/lib/phone_plan_spec.rb
.
Make sure all the tests are passing by running:
bundle exec rspec
Send me a link to your fork, you may want to create a PR as this is an opportunity to eloborate on any of the following:
- Any assumptions you made.
- What potential problems can you identify with the existing code?
- What approaches did you consider?
- How do your changes improve this code?
- Anything else you feel relevant?
The above will form the basis of a more technical discussion.