Completed as part of Tech Test week at Makers Academy written in Ruby and tested in Rspec.
git clone https://github.com/haletothewood/GildedRose-Refactoring-Kata
bundle
To see the Gilded Rose in action please run:
ruby texttest_fixture.rb
rspec
I began with extracting the user stories from the requirements provided in the challenge. From this I diagrammed using CRC cards and so had a mental model of the how the update method affected each different item. I began by writing all the tests for the different items. This gave me a base to begin refactoring and a story to match my new methods narrative to. I went through each test for an item and wrote the simplest code in a new method to make the test pass. Once I hit green I refactored. After each items update functionality was extracted into a private method I began the process of extracting into separate classes. As the instructions made it clear not to edit Item, I used inheritence to create a Normal item from Item and further inheritence for each special item from Normal item.