As a second tech test, we were given the infamous Gilded Rose Refactoring Kata, created by Terry Hughes. You can find the Kata on Github here and starting code for multiple programming languages here.
See here for the Kata's requirements.
I highly recommend watching Sandi Metz's talk which uses a simplified version of the Ruby code to showcase the importance of Single Responsibility and Open/Close Design Principles of the Object Oriented Programming.
- Clone repository
cd
to the project's root directory- Run
gem install bundler
- Run
bundle install
to install all of the required gems - Run
rspec
to make sure that all tests are passing - Run
ruby textest_fixture.rb
in the terminal. You can specify a number of days after the command.
- Ruby
- RSpec
Below are the steps that I undertook to solve this kata:
-
Write tests for the existing code base
-
Use the tests from step 1 to guide me through a refactor stage to simplify the
update_quality
method by breaking it into smaller methods -
Extract common functionality from
GildedRose
class into separate classes