Skip to content

Commit

Permalink
added customer model tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aruna79 committed May 7, 2018
1 parent 6fa399b commit 083604d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/fixtures/customers.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 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
state: Wa
postal_code: 98073
phone: 424234123

Sally:
name: Sally
sally:
name: sally
registered_at: 2018-05-07 14:24:47
address: 112 22st
city: sammamish
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/rentals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion test/models/customer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 083604d

Please sign in to comment.