kristyan/coins
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
== Change Calculator
A rails application responsible for calculating optimal change denomination for a given change value from 1 to 99 cents.
== Usage
This app was built using Rails version 2.3.5 and ruby 1.8.7
To start the application server in development mode locally, run script/server and goto http://localhost:3000/
You can then enter the change value in cents between 1 and 99 and the system will output the optimal change denomination
== config
The coin set that the application uses can be configured in config.yml.
For example to use the coin set [50,25,10,5,1] the following is added
coin_set:
- 50
- 25
- 10
- 5
- 1
== Unit Testing
The change calculator can be tested by running the unit tests as follows
The tests are written using standard rails testing
rake --trace test:units
== Files added
app/controllers/change_controller.rb
app/models/change_calculator.rb
app/views/change/index.erb
app/views/change/result.erb
test/unit/change_calculator.rb
config/config.yml
== Files Changed
config/routes.rb # new route was added
config/environment.rb # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] to run rails without a DB
test/test_helper.rb # fixtures related settings where commented out as we are running without DB