Sha256: 2e4fcc3bd38a9deca04fc23a39b50729cfeacbf348926f77e4f60094cbbd1584

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

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
      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
  end
end # TestMoney

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-money-0.1.0 test/test_money.rb