-
Notifications
You must be signed in to change notification settings - Fork 25
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
&& Steffany & Nicoleta #13
base: master
Are you sure you want to change the base?
Conversation
… movies_checked_out_count is updating. It looks like it is but smoke test is still failing
Video StoreWhat We're Looking For
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)} |
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.
tests????
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
you mean no movie
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