Date: October 20, 2018. Module 3 Project.
- Clone down this repo.
- Run the following in the command line:
bundle
andrake db:{create,migrate,seed}
Run tests with bundle exec rspec
In this project you will:
- Demonstrate mastery of all parts of the Rails stack
- Demonstrate mastery of Ruby throughout the process
- Write tests for the added features
Areas to be tested is explained in the Areas of Knowledge section of the Assessment doc.
Criteria is explained in the Expectations section of the Assessment doc.
Clone down and run through the README for Asteroids
Sign up for an API key through NASA
Work through the following challenges. The first section is easier so it should not take half the time if you plan on finishing both.
Background:
- This story should use the Asteroids Neo - Feed: https://api.nasa.gov/api.html#neows-feed
Feature: A guest user visits the root page and enters a start date and end date. The resulting page will display the most dangerous day in that range based on which day has the most is_potentially_dangerous_asteroid
set to true
. Given the scenario below, it should be January 1, 2018 with 3 potentially dangerous asteroids.
As a guest user
When I visit "/"
And I enter "2018-01-01" into the start date
And I enter "2018-01-07" into the end date
And I click "Determine Most Dangerous Day"
Then I should be on "/most_dangerous_day"
And I should see a heading for "Most Dangerous Day"
And I should see "January 1, 2018 - January 7, 2018"
And I should see a heading for the most dangerous day in that range "January 1, 2018"
And I should see 3 asteroids in that list
And I should see "Name: (2014 KT76)"
And I should see "NEO Reference ID: 3672906"
And I should see "Name: (2001 LD)"
And I should see "NEO Reference ID: 3078262"
And I should see "Name: (2017 YR1)"
And I should see "NEO Reference ID: 3794979"
Page should look something like this:
Background: This story assumes the base data from running rake db:seed
. Registered user has an api_key
of abc123
.
As a registered user
When I send a 'GET' request to '/api/v1/user/favorites?api_key=abc123'
Then I should receive a JSON response as follows:
[
{
"id":1,
"neo_reference_id": "2153306",
"user_id": 1,
"asteroid": {
"name": "153306 (2001 JL1)",
"is_potentially_hazardous_asteroid": false,
}
}
]
Background: This story assumes the base data from running rake db:seed
This SHOULD NOT save the asteroid data into the database. Asteroid data should be returned from the NASA API. You should save the neo_reference_id
in the favorites table.
When I send a POST request to "/api/v1/user/favorites" with an 'api_key' of 'abc123' and a 'neo_reference_id' of '2021277'
Then I should receive a response with a status code of 200
And the body should be JSON as follows:
{
"id":2,
"neo_reference_id": "2021277",
"user_id": 1,
"asteroid": {
"name": "21277 (1996 TO5)",
"is_potentially_hazardous_asteroid": false,
}
}
The criteria is located in the Assessment file.