Conversation
Migration, Smoke Tests Pass
Video StoreWhat We're Looking For
|
| end | ||
| end | ||
|
|
||
| def checkout |
| if movie | ||
| render json: movie.as_json(only: [:id, :release_date, :title, :overview, :inventory, :available_inventory]), status: :ok | ||
| else | ||
| render json: {"errors" => {"id" => ["Movie with id #{params[:id]} not found."]}} |
| @@ -0,0 +1,11 @@ | |||
| require "test_helper" | |||
|
|
|||
| describe Customer do | |||
There was a problem hiding this comment.
No validation tests?
Only testing having many rentals?
| end | ||
|
|
||
| it 'can make a movie with a title' do | ||
| assert @movie.valid? |
There was a problem hiding this comment.
These kinds of assertions work, but they're not in the style we're doing at Ada. So I'd suggest conforming to the spec-style testing.
| assert @movie.valid? | |
| expect(@movie.valid?).must_equal true |
|
|
||
| end | ||
|
|
||
| it 'is invalid and returns errors when movie has no availability' do |
There was a problem hiding this comment.
Just noting the incomplete test. It's good you were thinking about this.
| must_respond_with :ok | ||
| end | ||
|
|
||
| it 'responds with an array of customer hashes' do |
There was a problem hiding this comment.
What about when there are no customers?
| must_respond_with :ok | ||
| end | ||
|
|
||
| it 'responds with an array of movie hashes' do |
There was a problem hiding this comment.
What about when there are no movies?
| require "test_helper" | ||
|
|
||
| describe RentalsController do | ||
| describe "checkout" do |
There was a problem hiding this comment.
What about when there are no movies available for rental.
| end | ||
|
|
||
| describe "checkin" do | ||
| it "wont_change the db and responds ok for an existing customer and movie" do |
There was a problem hiding this comment.
| it "wont_change the db and responds ok for an existing customer and movie" do | |
| it "wont_change the Rental count in the db and responds ok for an existing customer and movie" do |
| expect { | ||
| post checkin_path, params: checkin_params | ||
| }.wont_change "Rental.count" | ||
|
|
There was a problem hiding this comment.
You should also check to verify if the movie is updated properly.
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.