Open
Conversation
… movies_checked_out_count is updating. It looks like it is but smoke test is still failing
Video StoreWhat We're Looking For
|
CheezItMan
reviewed
May 13, 2018
| proc { Customer.new(address: "1234 Candy Cane Lane") }.must_change 'Customer.count', 0 | ||
| end | ||
|
|
||
| it "must not save if name data is invalid" do |
There was a problem hiding this comment.
With these you really need to explicitly test that there is an error related to the validation.
Also Customer.new will never change the customer count (you haven't saved).
An example of a good validation test would be:
it "must be invalid without an address" do
customer = customers(:bob)
customer.address = nil
value(customer).wont_be :valid?
customer.errors.messages.must_include :address
end| end | ||
|
|
||
| it "must not create without title" do | ||
| proc { Movie.new(release_date: "2015-12-2", inventory: 2) }.must_change 'Movie.count', 0 |
There was a problem hiding this comment.
You have issues here similar to customer_test.rb
| require "test_helper" | ||
|
|
||
| describe Rental do | ||
| let(:rental) { Rental.new(movie_id: movies(:bride).id, customer_id: customers(:ada).id, checkout_date: Date.today, due_date: Date.today + 7)} |
|
|
||
| it "must not create without release date" do | ||
| proc { Movie.new(title: "Party", inventory: 2) }.must_change 'Movie.count', 0 | ||
| end |
There was a problem hiding this comment.
Missing tests on your custom method
| body.must_be_instance_of Array | ||
| end | ||
|
|
||
| it "returns all of the customers" do |
There was a problem hiding this comment.
What about a test when there are no customers?
| body["errors"].must_include "Customer not found" | ||
| end | ||
|
|
||
| it "returns an error if there is no customer" do |
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