1 require File.join( File.dirname(__FILE__), "..", "spec_helper" )
5 DataMapper.auto_migrate!
8 describe "associations" do
9 it "should has 1..n transactions" do
10 transactions = (1..10).of {Transaction.gen}
11 account = Account.create(Account.gen_attrs.merge(:transactions => transactions))
12 account.transactions.should == transactions
13 account.should be_valid
16 it "should belong to an address" do
18 account = Account.create(Account.gen_attrs.merge(:address => address))
19 account.address.should == address
21 account = Account.create(Account.gen_attrs.except(:address))
22 account.address.should be_nil
23 account.should_not be_valid
24 account.errors.should include(:address)