Skip to content

Commit 82cdc7c

Browse files
author
Robin Clart
committed
Improve README
1 parent aad256e commit 82cdc7c

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

README.md

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,32 @@ back to us.
1313
This app provides a way for merit makers to donate money to a charity of their
1414
choosing using their credit card.
1515

16+
At the root path you will find a list of charities, a field to enter an amount,
17+
and a series of credit card fields powered by omise. The amount must be sent in
18+
Thai Baht. But both Omise API and the total column in the charity table both expect an integer value in the smallest unit of the Thai Baht, the satang.
19+
20+
Note that you must signup for an omise account and replace both pkey and skey
21+
in the `config/secrets.yml` file to use the app in development mode.
22+
23+
To run the test simply run `rake test`. You'll notice that one test already
24+
fails. You'll have to fix the code (not the test) that produce this failure.
25+
1626
## Exercices
1727

18-
1. fix the race condition in the balance amount column;
19-
2. refactor the code in the donate action of the website controller;
20-
3. add a feature to allow a charity to be picked at random.
28+
1. fix the race condition in the balance amount column
29+
2. refactor and improve the code in the donate action
30+
3. fix and add integration tests to allow subunits in the amount field
31+
4. add a feature to allow a charity to be picked at random
32+
33+
Bonus point: Remove all `Rails.env.test?` conditionals from the code.
2134

2235
## Principles
2336

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

2740
Clarity: write clear code that any devs could read and understand in one go.
28-
Simplicity: write gimmic-free and straightforward code with no ambiguities.
41+
Simplicity: write gimmick-free and straightforward code with no ambiguities.
2942
Defensiveness: cover edge cases and treat user inputs with care.
3043

3144
## Testing
@@ -36,6 +49,13 @@ the rest of the code you'll write in existing or newly created classes and
3649
modules. Note that we require that all tests must pass before we can invite you
3750
in for an interview.
3851

52+
In test mode no network connection to Omise are made. In general we prefer
53+
duck-typing to make our test fast. In the codebase you'll notice that we use
54+
a bunch of conditionals that switch between doing call to the Omise library in
55+
normal use and constructing quick and dirty OpenStruct for test. Please keep it
56+
that way and make no network calls during the tests. But you're free to find
57+
another way to remove the conditionals as noted in the exercices list.
58+
3959
## Rules
4060

4161
You can:
@@ -55,13 +75,13 @@ You can't:
5575
## Submitting Your Code
5676

5777
You must email your changes as a git patch to [email protected]. Your patch must
58-
consist of three separate commits. One commits per exercice. Your commit message
59-
must communicate clearly what has been done in each commit. Have a look at
60-
previous commits to have a clear idea of what we expect.
78+
consist of multiple separate commits. One commits per exercice. Your commit
79+
message must communicate clearly what has been done in each commit. Have a look
80+
at previous commits to have a clear idea of what we expect.
6181

6282
If you notice more bugs in the original implementation you can add fixes for
63-
thoses as well. You won't be penalized if you don't. However we ask you not
64-
to add more features than the one given in the excercice list.
83+
those as well. You won't be penalized if you don't. However we ask you not
84+
to add more features than the one given in the exercise list.
6585

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

0 commit comments

Comments
 (0)