This is an attempt at a test-driven implementation of Ruby Quiz #122: Checking Credit Cards
All code is written in pure Ruby, with some help from ActiveModel::Validations for model validation checks and Thor for the command-line interface, and is tested using RSpec.
- Help with a Ruby-esque implementation of the Luhn algorithm came from this StackOverflow answer
- Test credit card numbers (valid and invalid) were generated using this credit card number generator by MobileFish
Install
$ bundle install
Run program:
$ bin/credit_card_checker
Code quality is attempted by using RSpec for testing, SimpleCov for code test coverage, Reek to fix code smells, as well as Code Climate and Coveralls for quality metrics.
Run tests:
$ rspec spec/
Check test coverage (after running rspec):
$ open coverage/index.html
Check code smells:
$ rake reek
Check quality metrics:
- Fix that one last code reek...
- More robust CLI testing and implementation; make handling of bad files fail gracefully, add more options etc.
Copyright (c) 2012 Paul Fioravanti
See MIT LICENSE for details.