Open
Conversation
…dex for customers controller
…upport creation of a rental and reduction to inventory in associated movie object.
… schema, made slight updates to check_out methods and added a few assertions to rental_controller_test.rb
…smoke tests before submitting.
Video StoreWhat We're Looking For
|
CheezItMan
reviewed
May 13, 2018
|
|
||
| }.must_change 'Movie.count', 1 | ||
|
|
||
| JSON.parse(response.body)["id"].must_equal 1072689925 |
There was a problem hiding this comment.
This test is failing because you can't really guantee the ID the test is going to generate, it probably doesn't need to be there.
Better would be:
JSON.parse(response.body).keys.must_include "id"
| movie.errors.messages.must_include :release_date | ||
| end | ||
|
|
||
| it "must have title" do |
| end | ||
|
|
||
| describe 'a_check_in' do | ||
| it 'must increase inventory by 1' do |
There was a problem hiding this comment.
What about checking in a movie that's not checked out?
| end | ||
| end | ||
|
|
||
| describe "relations" do |
| @@ -0,0 +1,226 @@ | |||
| require "test_helper" | |||
|
|
|||
There was a problem hiding this comment.
What about what happens when you try to check in a movie that's not checked out by that customer?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Video Store API
Congratulations! You're submitting your assignment!
If you didn't get to the functionality the question is asking about, reply with what you would have done if you had completed it.
Comprehension Questions
Describe a set of positive and negative test cases you implemented for a model. | For the rental model we tested for a case in which all required values were provided movie ID and customer ID. To test for a negative case we simulated a post action in which the customer ID, and also the movie Id was not provided.
Describe a set of positive and negative test cases you implemented for a controller. | For the get movie path we tested for an existing movie and for a non existing movie. An existing movie returned a hash with all movie information, and a non existing movie returned 404 not found
How does your API respond when bad data is sent to it? | In the case for a request to check_out a movie with a customer_id that does not exist, the API will respond with an error json, that sends back a message that the customer’s id is missing.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. | The reduction of available inventory is kept in a model method. Updating and saving an active record model seemed like business logic that should be kept outside of the controller.
Do you have any recommendations on how we could improve this project for the next cohort? | For the next cohort, I think there should be more instruction on using Smoke tests, and RABL.
Link to Trello | https://trello.com/b/vNEXohNE/video-store-api
Link to ERD | https://www.lucidchart.com/documents/edit/53439e24-0646-4b9e-acfc-5691c657c1a5/0?shared=true&existing=1&docId=53439e24-0646-4b9e-acfc-5691c657c1a5