Giter Club home page Giter Club logo

credit-card-test's Introduction

Credit Card Validator

Please find attached my solution to your credit card validation problem.

While working on this problem I adopted a classical TDD work flow, and this is my preferred method of development.

Instructions

To run the Credit Card Validator, please first run bundle install to install the required dependencies.

To check the validity of a credit card please run bin/card 4111111111111111

To use the class directly do the following:

card = CreditCard.new '4111111111111111'

card.issuer?
# => 'Visa'

card.valid?
# => true

card.number
# => 4111111111111111

Running the tests

There tests are written in RSpec and Cucumber for this problem. They run with the rspec and cucumber commands respectivly.

The RSpec tests are written as class unit tests. When I use RSpec, I generally follow the guidelines set out at http://betterspecs.org however I am very adaptable and can quickly learn and apply your chosen methodology.

The Cucumber tests check the functionality of the command line interface.

Unknown card issuers

I have left the class to allow a card to be reported as valid even if we are given 'Unknown' as the credit card issuer. We could add in an extra conditions so that cards of an 'Unknown' issuer are reported as invalid however this would require clarification and a specification from the product owner.

credit-card-test's People

Contributors

georgedrummond avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.