From da83423c2fce6d10236b20078ad64c24bac4fdd2 Mon Sep 17 00:00:00 2001 From: Janice Lichtman Date: Tue, 9 May 2017 16:44:12 -0700 Subject: [PATCH] wrote tests for movie model relationships --- test/fixtures/rentals.yml | 2 +- test/models/movie_test.rb | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/fixtures/rentals.yml b/test/fixtures/rentals.yml index 509127852..b04bd4703 100644 --- a/test/fixtures/rentals.yml +++ b/test/fixtures/rentals.yml @@ -19,7 +19,7 @@ three: due_date: 2017-05-09 four: - movie: exorcist: + movie: exorcist customer: curran checked_out: false due_date: 2017-05-09 diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb index 9866e0215..c4fc01eb6 100644 --- a/test/models/movie_test.rb +++ b/test/models/movie_test.rb @@ -3,6 +3,7 @@ describe Movie do describe "relations" do + it "has a list of rentals" do psycho = movies(:psycho) psycho.must_respond_to :rentals @@ -10,6 +11,15 @@ rental.must_be_kind_of Rental end end + + it "has a list of customers" do + psycho = movies(:psycho) + psycho.must_respond_to :customers + psycho.customers.each do |customer| + customer.must_be_kind_of Customer + end + end + end - + end