Open
Conversation
Feature model test
… and customers controllers with appropriate actions
…l do testing next
merge with movie controller actions
…r empty array if there are no existing customers
…entory, and altered seed.rb to set the value equal to json inventory values
…ion and updated test for new field
…ntroller creates tests for the create method in the movies controller
changes code to get smoke tests working
…e tests and added more details to the negative tests
creates test for movie relationships to rentals
adds tests for rental model validation tests and relationship tests
relationship testing customer has many rentals
… the controller and use strong params, and fixed movie controller tests to respect foreign key violation
…nteresting' changes to occur on the available_inventory of movies and the movies_checkout_count for a customer
…nnot exceed the inventory for a movie
… edited yml files
Video StoreWhat We're Looking For
|
CheezItMan
reviewed
May 13, 2018
| if customer && movie | ||
| if movie.available_inventory > 0 | ||
| rental = Rental.new(customer: customer, movie: movie, checkout_date: Date.today, due_date: Date.today + 7.days) | ||
| customer.movies_checked_out_count += 1 |
There was a problem hiding this comment.
This kind of business logic really doesn't go here.
| rental = Rental.find_by(customer: customer, movie: movie, returned: false) | ||
| if rental | ||
| rental.returned = true | ||
| customer.movies_checked_out_count -= 1 |
|
|
||
| it "can have no rentals" do | ||
| customer = customers(:shell) | ||
| customer.rentals.length.must_equal 1 |
There was a problem hiding this comment.
Why are you testing for a rental length of 1, if there are no rentals?
| body.must_include "id" | ||
|
|
||
| # Check that the ID matches | ||
| Movie.find(body["id"]).title.must_equal "The Princess Bride" |
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