From 083604deecf17ff75454d373d405e24581e6440e Mon Sep 17 00:00:00 2001 From: Aruna Date: Mon, 7 May 2018 15:18:55 -0700 Subject: [PATCH] added customer model tests --- test/fixtures/customers.yml | 8 ++++---- test/fixtures/rentals.yml | 4 ++++ test/models/customer_test.rb | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/test/fixtures/customers.yml b/test/fixtures/customers.yml index b41d86feb..3ed1887a9 100644 --- a/test/fixtures/customers.yml +++ b/test/fixtures/customers.yml @@ -1,7 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -Mary: - name: Mary +mary: + name: mary registered_at: 2018-05-07 14:24:47 address: 945 21st city: Seattle @@ -9,8 +9,8 @@ Mary: postal_code: 98073 phone: 424234123 -Sally: - name: Sally +sally: + name: sally registered_at: 2018-05-07 14:24:47 address: 112 22st city: sammamish diff --git a/test/fixtures/rentals.yml b/test/fixtures/rentals.yml index 30583256b..9dfdab362 100644 --- a/test/fixtures/rentals.yml +++ b/test/fixtures/rentals.yml @@ -3,7 +3,11 @@ one: checkout_date: 2018-05-07 due_date: 2018-05-07 + customer: mary + movie: one two: checkout_date: 2018-05-07 due_date: 2018-05-07 + customer: mary + movie: one diff --git a/test/models/customer_test.rb b/test/models/customer_test.rb index 5ebc5c850..744eb07e1 100644 --- a/test/models/customer_test.rb +++ b/test/models/customer_test.rb @@ -2,8 +2,22 @@ describe Customer do let(:customer) { Customer.new } + let(:customer) { customers(:Mary)} + + describe "relations" do + it "has a list of rentals" do + mary = customers(:mary) + mary.must_respond_to :rentals + mary.rentals.each do |rental| + mary.must_be_kind_of Rental + end + end + + end it "must be valid" do - value(customer).must_be :valid? + + + end end