1 require File.join( File.dirname(__FILE__), "..", "..", "spec_helper" )
3 describe Mart::Order do
6 @order = Mart::Order.new
9 describe "associations" do
10 it "should belong to account" do
11 @order.should respond_to(:account)
12 @order.should respond_to(:account=)
15 it "should belong to a customer" do
16 @order.should respond_to(:customer)
17 @order.should respond_to(:customer=)
20 it "should have many (1..*) line items" do
21 @order.should respond_to(:line_items)
22 #@order.should respond_to(:line_items=)
25 it "should have at least one line item"
27 it "should have a billing address" do
28 @order.should respond_to(:billing_address)
29 @order.should respond_to(:billing_address=)
32 it "should have a shipping address" do
33 @order.should respond_to(:shipping_address)
34 @order.should respond_to(:shipping_address=)
37 it "may belong to a promotion" do
38 @order.should respond_to(:promotion)
39 @order.should respond_to(:promotion=)
44 it "should be valid" do
45 @order.order_number = 23
46 @order.should be_valid
49 it "should have a total"
51 describe "class methods" do
53 it "should return a search result" do
57 it "should generate an order number" do
58 #Mart::Order.generate_order_number
60 Mart::Order.should respond_to(:generate_order_number)
64 it "should get totals"
66 it "should get CSV for orders" do
67 order1 = Mart::Order.new
68 order2 = Mart::Order.new
69 order_list = Array.new
70 #order_list << [order1, order2]
71 order_list << Mart::Order.new
72 order_list << Mart::Order.new
73 order_list.should_not == nil
74 #@csv = Mart::Order.get_csv_for_orders(order_list)
78 it "should get XML for orders" do
79 order1 = Mart::Order.new
80 order2 = Mart::Order.new
81 order_list = Array.new
82 order_list << Mart::Order.new
83 order_list << Mart::Order.new
84 order_list.should_not == nil
85 #@xml = Mart::Order.get_xml_for_orders(order_list)
89 it "should get order status"
93 it "should assign line items from a hash"
95 it "should get the total amount of all line items associated with this order"
97 it "should test weight"
99 #it "should connect to FedEx to get shipping prices"
101 it "should work for a valid transaction"
102 it "should not work for an invalid transaction"
104 #it "should clean up"
105 #it "should not cleanup"
108 it "should have a shipping type"
110 it "should have a order status code"
112 it "should belong to a promotion"
114 it "should have a unique order number"