This is a starter repo for Credit Check, a Turing School Back End Mod 1 project described in more detail here.
- From the rightmost digit, which is the check digit, moving left, double the value of every second digit if product of this doubling operation is greater than 9 (e.g., 7 * 2 = 14), then sum the digits of the products (e.g., 10: 1 + 0 = 1, 14: 1 + 4 = 5).
- Take the sum of all the digits
- If and only if the total modulo 10 is equal to 0 then the number is valid
- Define credit card number
- Find a method that splits the credit card number (hint: this is a string)
- Convert string to array
- Find a method that reverses the return value of the split number (array)
- Double every other digit of the array
- Determine if the doubled digit is greater than 9
- For digits greater than 9, sum the digits
- Sum the results
- Run a method that divides the summed number by 10,
- if the modulo = 0, then the card is valid,
- if modulo != 0, then the card is invalid
- Output a message indicating whether the card number is valid or invalid
- If it is valid, print "The number is valid!"
- If it is invalid, print "The number is invalid!"
Ruby Syntax & Style
- Naming follows convention (is idiomatic)
- Ruby methods used are logical and readable
- Code is indented properly
- Code does not exceed 80 characters per line
Breaking Logic into Components
- Code is effectively broken into methods & classes
- May break the principle of SRP
Test-Driven Development
- Each method is tested
- Functionality is accurately covered
- Tests implement Ruby syntax & style
- Balances unit and integration tests
- Evidence of edge cases testing
- A test RakeTask is implemented
Functionality
- Application meets all requirements (extension not req’d)
Rake task test code taken from this website:
https://medium.com/@jaeger.rob/a-simple-ruby-rakefile-for-tests-149a7b783c52