2014-12-04 19:50:02 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: orders
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# user_id :integer
|
|
|
|
# cost :integer
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
#
|
|
|
|
|
2014-11-09 22:53:39 +01:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class OrderTest < ActiveSupport::TestCase
|
2015-03-03 15:56:23 +01:00
|
|
|
test "order total price is correct" do
|
|
|
|
o = Order.new
|
|
|
|
o.order_items.build(product: products(:fanta), count: 1)
|
|
|
|
o.order_items.build(product: products(:bueno), count: 2)
|
|
|
|
assert_equal o.price, 300
|
|
|
|
end
|
2014-11-09 22:53:39 +01:00
|
|
|
end
|