0xff6a / gift-aid-calculator

Technical Test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Technical Test: Gift Aid Calculator

Code Climate Test Coverage

Please run feature tests (instructions below) for detailed description of functionality

Ruby Version:

Ruby 2.1.2

Objectives:

  • Create a simple gift aid calculator
  • Gift Aid calculated as donation_amount * ( tax_rate / (100 - tax_rate ) )
  • Allow an admin user to update the tax rate
  • Ensure rounding to two decimal places
  • Allow gift aid to be supplemented based on event type

Classes:

  • GiftAidCalculator: calculates gift aid from inputs
  • User: cannot alter the tax rate
  • Admin: can alter the tax rate
  • Event: can supplement gift aid based on type

Workings:

  • Worked in pure TDD style throughout and ensured thorough test coverage
  • Started with a single class to complete the first user story and added additional classes as complexity grew to maintain single responsibility
  • Created user and admin class to update tax rate for extensibility and to ensure code remained semantically rich (vs a simple admin/user input to GiftAidCalculator functions)
  • Command line interface to demonstrate functionality would have been clunky and inflexible so created simple sinatra web app instead
  • Created cucumber feature tests based on stories provided

Running the test suite:

From root directory:

Feature Tests

$ bundle
$ cucumber

Unit Tests

$ bundle
$ rspec

Running the application:

From root directory opens the application on http://localhost:9292/. Authentication string to change tax rate is 'JGHackers'.

$ bundle
$ rackup 

About

Technical Test


Languages

Language:Ruby 96.3%Language:CSS 3.7%