|
| 1 | +# Rails Programming Task |
| 2 | + |
| 3 | +### In order to be considered for a rails position, you must complete the following steps. |
| 4 | +*Note: This task should take no longer than 1-2 hours at the most to complete.* |
| 5 | + |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Please note that this will require some basic [Ruby on Rails](http://rubyonrails.org/) and [RSpec](http://rspec.info/) knowledge. |
| 10 | + |
| 11 | +- You will need to have [Ruby on Rails](http://www.rubyonrails.org/) installed to complete this task. |
| 12 | + |
| 13 | +## Task |
| 14 | + |
| 15 | +- Fork this repository (if you don't know how to do that, Google is your friend) |
| 16 | +- Create a *source* directory. |
| 17 | +- In the *source* directory, scaffold a simple Rails 4 web app that models a credit card charge. JSON data structure below: |
| 18 | + |
| 19 | +``` |
| 20 | + { |
| 21 | + "id": 9923, |
| 22 | + "created": 1389618241, |
| 23 | + "paid": true, |
| 24 | + "amount": 4900, |
| 25 | + "currency": "usd", |
| 26 | + "refunded": false, |
| 27 | + "customer_id" : 123 |
| 28 | + } |
| 29 | +``` |
| 30 | + |
| 31 | + *Note: Amount is in USD, cents* |
| 32 | + |
| 33 | +- Also scaffold a customer object which only has a first and last name. |
| 34 | + |
| 35 | +*The charge object has a customer property, this property is the customer id from the customer model.* |
| 36 | + |
| 37 | +##### Seed 4 Customers into the system |
| 38 | + Customer 1: |
| 39 | + First Name: Johny |
| 40 | + Last Name: Flow |
| 41 | + |
| 42 | + Customer 2: |
| 43 | + First Name: Raj |
| 44 | + Last Name: Jamnis |
| 45 | + |
| 46 | + Customer 3: |
| 47 | + First Name: Andrew |
| 48 | + Last Name: Chung |
| 49 | + |
| 50 | + Customer 4: |
| 51 | + First Name: Mike |
| 52 | + Last Name: Smith |
| 53 | + |
| 54 | + |
| 55 | +##### Seed 20 transactions (charges) into the system |
| 56 | + |
| 57 | + 10 Should be successful transactions: |
| 58 | + - 5 Should be linked to Customer 1 |
| 59 | + - 3 Should be linked to Customer 2 |
| 60 | + - 1 Should be linked to Customer 3 |
| 61 | + - 1 Should be linked to Customer 4 |
| 62 | + |
| 63 | + 5 Should be transactions that failed: |
| 64 | + - 3 Should be linked to Customer 3 |
| 65 | + - 2 Should be linked to Customer 4 |
| 66 | + |
| 67 | + 5 should be disputed: |
| 68 | + - 3 should be linked to Customer 1 |
| 69 | + - 2 should be linked to customer 2 |
| 70 | + |
| 71 | + |
| 72 | +##### Create a Visual Representation of Different Charges |
| 73 | +On the view that shows all charges (most likely the *GET /charges* route), create three lists with H1 headers. |
| 74 | + |
| 75 | +- List 1 - |
| 76 | + - Header: Failed Charges |
| 77 | + - In this list set the background color of the rows to #FF0000 and list the Customers name, the charge amount and the date that the charge failed for each failed charge. |
| 78 | + |
| 79 | +- List 2 - |
| 80 | + - Header: Disputed Charges |
| 81 | + - In this list set the background color of the rows to ##FF5400 and list hte Customers name, the charge amount and the date that the charge was disputed for each disputed charge. |
| 82 | + |
| 83 | +- List 3 - |
| 84 | + - Header: Successful Charges |
| 85 | + - In this list simply display all the charges that were succesfull. |
| 86 | + |
| 87 | +### Tests |
| 88 | + |
| 89 | +Create the following RSpec tests: |
| 90 | + |
| 91 | + 1. Verify that there are three lists on the screen. One for Successful charges, one for failed charges and one for the disputed charges. |
| 92 | + 2. Verify that in the Successful charges list there are 10 line items. Verify that in the failed charges list there are 5 failed charges. Verify that in the disputed charges list there are failed charges. |
| 93 | + |
| 94 | +## Once Complete |
| 95 | +1. Commit and Push your code to your new repository |
| 96 | +2. Send us a pull request, we will review your code and get back to you |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
0 commit comments