Whitespace cleanup
[merb_mart.git] / spec / models / account_spec.rb
blob811f15d1da0ae0c439b24d5856ecedbebecf2634
1 require File.join( File.dirname(__FILE__), "..", "spec_helper" )
3 describe Account do
4   before(:each) do
5     DataMapper.auto_migrate!
6   end
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
14     end
16     it "should belong to an address" do
17       address = Address.gen
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)
25     end
26   end
27 end