26 lines
1.1 KiB
Markdown
26 lines
1.1 KiB
Markdown
# Ruby Technical Test
|
|
|
|
## Dependencies
|
|
|
|
* Ruby 4.0.6
|
|
* Minitest 6.0.6
|
|
* Rake 13.4.2
|
|
|
|
## Instructions
|
|
|
|
Run tests with `rake test`
|
|
|
|
|
|
## New since last review!
|
|
|
|
As instructed, the functionality has been expanded.
|
|
|
|
Here is a summary before you dive in:
|
|
|
|
* Tests are now run via `rake test`, and the `main.rb` scratchpad has been removed.
|
|
* Product information is now stored in a `Product` class that can be instantiated with an ID, price, and discount if applicable. There is a `Shop` class that keeps track of these.
|
|
* The `Checkout` class still exists, but adding and removing items can now be done in bulk. We still use product IDs when doing this.
|
|
* Discount logic is encapsulated in a class. Each product can have one kind of discount at the moment, chosen from "Buy X get one free" or "Bulk discount when X are purchased" in order to satisfy requirements.
|
|
* New test classes have been created as appropriate, although the bulk of the tests are still against the `Checkout` class.
|
|
* See the `setup` method in `tests/checkout_test.rb` for a full example of how a shop might be configured.
|