No description
- Ruby 100%
| lib | ||
| test | ||
| .ruby-version | ||
| .tool-versions | ||
| Gemfile | ||
| Gemfile.lock | ||
| Rakefile | ||
| README.md | ||
Raspberry Pi Technical Test
Setup
-
Install Ruby 4.0.5 and
bundlerusing your preferred method. -
Run:
$ bundle install
Run Tests
$ rake test
Notes
-
I'm storing the prices as an integer number of pennies. This avoids any rounding issues with floats. Other options might be
BigDecimalor using themoneygem. -
I've implemented the promotions as an overrideable
sumproc on each product. This works well but wouldn't really be practical for a user to administer in any way. -
The
buy_one_get_one_freepromotion proc could probably be refactored to be abuy_x_get_one_freemethod, but this would make the maths more complicated. -
There is currently no way to remove a product from the checkout. We can implement a
#removemethod easily enough. -
There are currently no tests for the
Promotionsmodule. I would have added some if I'd had more time.
New Requirements
- If you buy a Raspberry Pi 5, and a Zero 2W, you get £5 discount