Fix a few missed renames
[merb_mart.git] / spec / models / weight_spec.rb
blob1b29a15d242f897cd4b988ab5f845878d47de95a
1 require File.join( File.dirname(__FILE__), "..", "spec_helper" )
3 describe Order do
4   before(:each) do
5     DataMapper.auto_migrate!
6   end
8   describe "associations" do
9     it "should belong to a shipping_info" do
10       shipping_info = ShippingInfo.gen
11       weight = Weight.gen(:shipping_info => shipping_info)
12       weight.shipping_info = shipping_info
13       weight.should be_valid
15       weight = Weight.create(Weight.gen_attrs.except(:shipping_info))
16       weight.shipping_info.should be_nil
17       weight.should be_valid
18     end
19   end
21   it "should require a min_weight, max_weight, and price" do
22     weight = Weight.create(Weight.gen_attrs.except(:min_weight))
23     weight.should_not be_valid
24     weight.errors.should include(:min_weight)
26     weight = Weight.create(Weight.gen_attrs.except(:max_weight))
27     weight.should_not be_valid
28     weight.errors.should include(:max_weight)
30     weight = Weight.create(Weight.gen_attrs.except(:price))
31     weight.should_not be_valid
32     weight.errors.should include(:price)
33   end
34 end