Conversation
…d movie, fleshed out the customer tests, all passing
…pi into change_rental_setup
| end | ||
| end | ||
|
|
||
| def checkin |
There was a problem hiding this comment.
Consider implementing Checkin so that it does not create new rental but checks in an existing rental. You'd need to first find the rental and then checkin. Some of this logic would go in a custom model method.
There was a problem hiding this comment.
In addition, checkin and checkout should affect available movie inventory -- this will likely be a custom method in the movie model.
There was a problem hiding this comment.
I realize now that movie inventory is optional -- I talked about this with Cloudy
| render json: movie.as_json(only: [:id, :title, :overview, :release_date, :inventory]), status: :ok | ||
| return | ||
| else | ||
| render json: { ok: false, "errors" => ["Not Found"]}, status: :not_found |
There was a problem hiding this comment.
Instead of "error" --> ["Not Found"] you should report any errors in the movie model created by validations by accessing movie.errors.messages.
| avengers = movies(:avengers) | ||
| zootopia = movies(:zootopia) | ||
|
|
||
| #Act |
There was a problem hiding this comment.
It seems you don't use the variable rental. As such, you don't need this assignment.
|
|
||
| # Assert | ||
| expect(mariya.movies.count).must_equal 1 | ||
| end |
There was a problem hiding this comment.
Consider the case where a movie has no rentals or customers.
| end | ||
| end | ||
|
|
||
| describe "validations" do |
There was a problem hiding this comment.
thorough validation tests. nice work!
|
|
||
| it "has rentals" do | ||
| expect(@up.rentals.count).must_equal 4 | ||
| end |
There was a problem hiding this comment.
Also consider the edge cases of having no rentals or customers.
Video StoreWhat We're Looking For
|
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
POST /rentals/check-inendpoint? What does the time complexity depend on? Explain your reasoning.