Skip to content
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

Queues - Andrea Valliere & Kaitlin Ramirez - VideoStoreAPI #9

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added model tests for Movie. Added validation to Movie model
avalliere committed May 12, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a0bdc95d3162453033d3c365d2df1526a5938387
1 change: 1 addition & 0 deletions app/models/movie.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Movie < ApplicationRecord
has_many :rentals
has_many :customers, :through => :rentals
validates :title, presence: true
end
19 changes: 19 additions & 0 deletions test/models/movie_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
require "test_helper"

describe Movie do
let(:movie) { Movie.new }

describe "validations" do
it "must create a new movie with good info" do
movie.title = "Movie"
movie.overview = "Great"
movie.release_date = "1987-11-17"
movie.inventory = 1
movie.save!
movie.valid?.must_equal true
end

it "is invalid without a title" do
movie.overview = "Great"
movie.release_date = "1987-11-17"
movie.inventory = 1
# movie.save!
movie.valid?.must_equal false
end
end
end