Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
=== How to use 1. Try test.run.rb with no arguments. It will run in the "test" environment and it will process input.txt by default with a fresh database each time. ./batch_run.rb < test_input.txt ./initdb.rb # run initdb.rb between runs to wipe out the database cat test_input.txt | ./batch_run.rb ./initdb.rb ./batch_run.rb test_input.txt ./initdb.rb Usage from the keyboard. 1. create db: ./initd.rb 2. start batch import process: ./batch_run.rb Add Alice 4111111111111111 $2000 Add Bob 5454545454545454 $4000 Charge Alice $800 Charge Alice $7 Charge Bob $200 Charge Bob $100 CTRL+D Alice: $807 Bob: $300 === Input rules 1. Space delimited values 2. credit cards should be up to 19 characters, all numeric 3. Amounts should be prefixed with $ and and integers. === Programming language Ruby - it's my favourite language. Fast to develop, easy to debug, and with a vibrant community and projects. === Testing framework Rspec - what is there to choose? Test::Unit? === RVM and bundler I'm running on 1.9.2 with rvm. You should prefix all commands with bundle exec if you are not using rvm and a clean gemset. === Why Datamapper Because I don't have to run migrations, and it has object identity. I also wanted to experiment with DataMapper. I encountered a bug on datamapper while developing with it and submitted on the github issue tracker for dm-validations https://github.com/datamapper/dm-validations/issues/16#issuecomment-2648857 This bug causes the validations to come up with no errors on child classes when they should have. Saving of invalid records is prevented though. I have a couple of tests in spec/transaction/shared_examples.rb to document the bug and to prove that the save still fails on invalid records. === Other known issues Race condition in overlimit calculation - must fix in SQL. Let me know if you want to see a solution. Not complete code coverage in batch.rb I went on a code spike and didn't go back to build tests for it === Autotest run it with $ bundle exec autotest --style rspec2 I like specdoc format and colors, so they are enabled in the Rspec configure block. === Database is sqlite3 The databases for the test and development environment are in the test directory (partly because I don't want a write to the database to trigger another autospec run and partly because they are really temporary).