1 require File.join( File.dirname(__FILE__), "..", "spec_helper" )
5 describe "associations" do
6 it "should belong to a country"
7 it "should have one order"
8 it "should belong to a customer (OrderUser)"
11 it "should require a customer"
12 it "should require a zip"
13 it "should require a telephone"
14 it "should require a first name"
15 it "should require a last name"
16 it "should require an address"
18 it "should limit the first name to be a maximum of 50 characters" do
21 address.first_name = "a" * num
23 address.errors.on(:first_name).should be_nil
26 address.first_name = "a" * 51
28 address.errors.on(:first_name).should_not be_nil
31 it "should limit the last name to be a maximum of 50 characters" do
34 address.last_name = "z" * num
36 address.errors.on(:last_name).should be_nil
39 address.last_name = "z" * 51
41 address.errors.on(:last_name).should_not be_nil
44 it "should limit the address to a maximum of 255 characters"
46 #it "should not allow PO Box or variants to be entered as an address"
48 #it "should find a shipping address for a customer (OrderUser)" do
49 # order_address = Address.find_shipping_address_for_user(1)
52 it "should provide a name" do
54 address.first_name = "John"
55 address.last_name = "Doe"
56 address.name.should == "John Doe"