Skip to content
Snippets Groups Projects
Commit c3e188cb authored by Butler, Alexis (UG - Computer Science)'s avatar Butler, Alexis (UG - Computer Science)
Browse files

Wrote order model tests

parent c3297fe3
No related branches found
No related tags found
No related merge requests found
require 'test_helper' require 'test_helper'
class OrderTest < ActiveSupport::TestCase class OrderTest < ActiveSupport::TestCase
# test "the truth" do test 'should have default total cost' do
# assert true order = Order.new(email: "BillingEmail@bill.com", user: users(:one))
# end assert_equal(0,order.totalCost)
end
test 'should not save without user' do
order = Order.new(totalCost: 52, email: "BillingEmail@bill.com")
assert !order.save
end
test 'should not save without email' do
order = Order.new(totalCost: 52, user: users(:one))
assert !order.save
end
test 'should save valid order' do
order = Order.new(totalCost: 52, email: "BillingEmail@bill.com", user: users(:one))
assert order.save!
end
test 'orders belong to users' do
assert_equal(users(:one).firstName, orders(:one).user.firstName)
end
test 'orders contain order entries' do
assert_equal(2, orders(:one).order_entries.size)
end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment