1 require File.join( File.dirname(__FILE__), "..", "..", "..", "spec_helper" )
3 describe ProductImage do
5 DataMapper.auto_migrate!
8 describe "associatons" do
9 it "should belong to a product" do
11 product_image = ProductImage.create(ProductImage.gen_attrs.merge(:product => product))
12 product_image.product.should == product
13 product_image.should be_valid
15 product_image = ProductImage.create(ProductImage.gen_attrs.except(:product))
16 product_image.product.should be_nil
17 product_image.should_not be_valid
18 product_image.errors.should include(:product)