test/test_money.rb in dm-money-0.1.0 vs test/test_money.rb in dm-money-0.1.1

- old
+ new

@@ -6,11 +6,11 @@ Object.send(:remove_const, :Cake) if defined?(Cake) class ::Cake include DataMapper::Resource property :id, Serial property :type, String - money :price + money :price, :default => BigMoney.new(0, :aud) end # Cake end should 'behave like accessor' do price = BigMoney.new('2.50', :aud) @@ -24,8 +24,14 @@ price = BigMoney.new('2.80', :aud) assert_nothing_raised do cake = Cake.create(:type => 'sponge', :price => price) assert_equal price, cake.price end + end + + should 'have BigMoney default' do + price = BigMoney.new(0, :aud) + cake = Cake.create(:type => 'banana') + assert_equal price, cake.price end end end # TestMoney