You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-9Lines changed: 29 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,32 @@ back to us.
13
13
This app provides a way for merit makers to donate money to a charity of their
14
14
choosing using their credit card.
15
15
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
+
16
26
## Exercices
17
27
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.
21
34
22
35
## Principles
23
36
24
37
We want you to focus on those three principles while writing code:
25
38
clarity, simplicity and defensiveness.
26
39
27
40
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.
29
42
Defensiveness: cover edge cases and treat user inputs with care.
30
43
31
44
## Testing
@@ -36,6 +49,13 @@ the rest of the code you'll write in existing or newly created classes and
36
49
modules. Note that we require that all tests must pass before we can invite you
37
50
in for an interview.
38
51
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
+
39
59
## Rules
40
60
41
61
You can:
@@ -55,13 +75,13 @@ You can't:
55
75
## Submitting Your Code
56
76
57
77
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.
61
81
62
82
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.
65
85
66
86
Note that we will outright reject any submission which does not follow the
0 commit comments