-
Notifications
You must be signed in to change notification settings - Fork 26
Carla & Laneia #13
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
base: master
Are you sure you want to change the base?
Carla & Laneia #13
Conversation
Customers
… movies-and-rentals
Video StoreWhat We're Looking For
|
| end | ||
|
|
||
| def checkin | ||
| rental = Rental.find_by(movie_id: rental_params[:movie_id], customer_id: rental_params[:customer_id], status: "Checked Out") |
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 line is too long, instead break it up over several lines.
| validates :title, :overview, :release_date, presence: true | ||
| validates :inventory, :available_inventory, presence: true, numericality: {only_integer: true, greater_than_or_equal_to: 0} | ||
|
|
||
| def 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 business logic method!
|
|
||
| validates :customer_id, :movie_id, :due_date, :checkout, :status, presence: true | ||
|
|
||
| def available?(movie_id) |
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.
👍
| @@ -0,0 +1,28 @@ | |||
| require "test_helper" | |||
|
|
|||
| describe Customer do | |||
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.
No tests for relationships, minor
| end | ||
| end | ||
|
|
||
| describe "routes" do |
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.
routes?
| get movie_path(movies(:one).id) | ||
| body = JSON.parse(response.body) | ||
|
|
||
| expect(body.keys.sort).must_equal movie_fields |
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.
👍
| } | ||
| } | ||
|
|
||
| it "can create a new rental provided valid data" do |
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.
What about if there are no available movies?
| end | ||
| end | ||
|
|
||
| describe "checkin" do |
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.
What about trying to check in a movie which isn't checked out?
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.