Sha256: f457e4210851c76c38761ef155dac43e3533e4835a8a36f171c721f90d9359df
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
require File.join(File.dirname(__FILE__), 'helper') class TestMoney < Test::Unit::TestCase context 'BigMoney' do setup do Object.send(:remove_const, :Cake) if defined?(Cake) class ::Cake include DataMapper::Resource property :id, Serial property :type, String money :price, :default => BigMoney.new(1, :aud) end # Cake end should 'behave like accessor' do price = BigMoney.new('2.50', :aud) cake = Cake.create(:type => 'carrot') assert cake.price = price assert_equal price, cake.price end should 'be accepted by constructor' do 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 default' do price = BigMoney.new(1, :aud) cake = Cake.create(:type => 'banana') assert_equal price, cake.price end should 'have default currency' do assert_equal BigMoney.currency(:aud).to_s, Cake.properties[:price_currency].default end should 'have default amount' do assert_equal BigDecimal.new('1'), Cake.properties[:price_amount].default end end end # TestMoney
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dm-money-0.2.0 | test/test_money.rb |
dm-money-0.1.4 | test/test_money.rb |
dm-money-0.1.3 | test/test_money.rb |
dm-money-0.1.2 | test/test_money.rb |