Required Demos-n-Deets demos:
Optional demos (for now): Everything else in the “Model Tests and Validations” section of the Demos-n-Deets.
Follow the general instructions for active reading for the above required demos.
What to submit:
todo_test.rb
file and one of the terminal after running the rails test -v
command.review.rb
file, one of the review_test.rb
file, and one of the terminal after running the rails test -v
command.review.rb
file, one of the review_test.rb
file, and one of the terminal after running the rails test -v
command.review.rb
file, one of the review_test.rb
file, and one of the terminal after running the rails test -v
command.Important! All screenshots must include your computer’s desktop in the background so that it is recognizable as your desktop. Also, all screenshots of web pages must display the entire URL of the page in the browser’s location bar. (Watch out, as some browsers like to hide parts of the URL unless you click on it.)
Before proceeding, be sure to read the general description and instructions for the practice tests.
Start with the base project on the main
branch of this repo: https://github.com/memphis-cs/practice-apps-2021-01spring
Task to perform:
You must implement a Rails model class (including migration) as per this class diagram:
You must create two text fixtures as follows:
Fixture Name | HTTP Verb | Resource Path | Data Payload |
---|---|---|---|
one |
GET |
/universes/616 |
|
two |
POST |
/heroes |
Thor, Avengers, Asgard |
You must create a model test that verifies that each of the fixtures are valid.
You must add two model validations to ensure that neither of the verb
and resource_path
model attributes are left blank.
You must add a model validation to ensure that the verb
attribute is one of the following: “GET”, “POST”, “PUT”, “PATCH”, or “DELETE” (hint: think inclusion validations).
You must add a model validation to ensure that if the verb
attribute is “GET” or “DELETE”, the data_payload
attribute must be blank; otherwise, the attribute must be non-blank (hint: think custom validations). Note that Rails provides a blank?
method that you can use to test whether an attribute is blank.
For each of the four model validations, you must create a model test that verifies that the validation will catch the invalid data that it’s supposed to. Each of these tests must use at least one of the test fixtures.
What to submit:
rails test -v
command that runs all the tests.Important! All screenshots must include your computer’s desktop in the background so that it is recognizable as your desktop. Also, all screenshots of web pages must display the entire URL of the page in the browser’s location bar. (Watch out, as some browsers like to hide parts of the URL unless you click on it.)
Before proceeding, be sure to read the general instructions for the explanation videos.
Start with the base project on the main
branch of this repo: https://github.com/memphis-cs/practice-apps-2021-01spring
The video can begin after you have cloned, initialized, and run the base app.
Task to perform:
First, you must imagine a model class of your own invention. Be creative, but also make sure that whatever you come up with makes sense. Additionally, your model class must have the following:
string
attribute.integer
attributes.id
and timestamps).You must also imagine constraints on your model class attributes such that they must obey the following properties in order to be valid:
inclusion
validations).Given this model class, you must implement the following:
one
and two
) for the model class.Important! Be sure to run and test the things you build in your video (e.g., as per the “Test It!” demo steps).
Time limit: 30 minutes