Giter Club home page Giter Club logo

tam-boon's Introduction

Tam Boon

Tam Boon

Tam boon (which means "making merit" in Thai) is a simple Ruby on Rails app that contains bugs and rough code that you need to fix and refactor in order to be offered an interview at Omise.

Read this document entirely before starting the exercises as you'll learn how we expect you to write code, our rules for code and how to submit your changes back to us.

Setup

This app provides a way for merit makers to donate money to a charity of their choosing using their credit card.

At the root path you will find a list of charities, a field to enter an amount, and a series of credit card fields powered by Omise. The amount must be sent in Thai Baht. But both the Omise API and the total column in the charity table expect an integer value in the smallest unit of the Thai Baht, the satang.

Note that you must register an Omise account and replace both the pkey and skey fields in config/secrets.yml to use the app in development mode.

To run the test simply run rake test. You'll notice that two tests already fail. You'll have to fix or add code (without changing these two tests) to make them pass.

Exercises

  1. Fix the race condition in the balance amount column.
  2. Refactor and improve the code in the donate action.
  3. Fix and add integration tests to allow subunits in the amount field.
  4. Add a feature to allow a charity to be picked at random.

Bonus exercise: Remove all Rails.env.test? conditionals from the code.

Principles

We want you to focus on those three principles while writing code: clarity, simplicity and defensiveness.

  • Clarity: write clear code that any developer can read and understand in one go.
  • Simplicity: write gimmick-free and straightforward code with no ambiguities.
  • Defensiveness: cover edge cases and treat user inputs with care.

Testing

This app comes with a full test suite. The integration tests for the fix and for the new feature are already written. It's up to you to write unit tests for the rest of the code you'll write in existing or newly created classes and modules. Note that we require that all tests must pass before we can invite you in for an interview.

In test mode no network connection is made to Omise servers. In the codebase you'll notice that we use conditionals to switch between doing call to the Omise library in normal use and constructing an OpenStruct for test.

You may not make network calls during the tests. However, if you can think of a better way to do the testing than using these conditionals, you're free to implement this, and your improvement will be taken in to account in your scoring.

Rules

You can:

  • re-organize the codebase;
  • create new classes/modules/methods;
  • modify existing code;
  • add tables or columns in the existing database schema.

You can't:

  • change existing behaviors;
  • install more gems than those already in the Gemfile;
  • change the database from PostgreSQL to something else;
  • change any of the urls or parameter names.

If you notice more bugs in the original implementation you can add fixes for those as well. You won't be penalized if you don't. However we ask you not to add more features than the one given in the exercise list.

Note that we will outright reject any submission which does not follow the guidelines outlined in this README.

tam-boon's People

Contributors

systumabdul avatar

Watchers

James Cloos avatar Abdul Sohail 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.