-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipes - Iuliia and Irene - VideoStoreAPI #4
base: master
Are you sure you want to change the base?
Conversation
Customer controller testing
More customer
Add serializer to customer
Video StoreWhat We're Looking For
|
else | ||
render( | ||
json: {nothing: true}, status: :not_found | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will literally send back { nothing: true }
as a JSON response. Not sure that's what you intended.
@@ -0,0 +1,14 @@ | |||
class Movie < ApplicationRecord | |||
before_create :set_available_inventory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of a model filter here.
Another strategy is, instead of storing available inventory as a column in the DB, compute it on the fly based on what rentals currently exist for this movie. This would be a little more work, but avoids storing redundant information.
movie = Movie.new(invalid_data) | ||
|
||
movie.wont_be :valid? | ||
Movie.count.must_equal before_count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here (and above in the same test for Customer
) it would be good to check which fields are failing to validate, to ensure that all the problems are being caught. As is, I could remove any one of the validations and this test would continue to pass.
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