Sha256: 9874654d4bf9d02b9801ac2c4e74cfc87083c8a2b24c9c3fa82f5129c02512f6
Contents?: true
Size: 1001 Bytes
Versions: 1
Compression:
Stored size: 1001 Bytes
Contents
# encoding: utf-8 require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require 'big_money/exchange' class TestEx < BigMoney::Exchange def self.read_rate(from, to) BigDecimal.new('2') end def self.currencies BigMoney::Currency.all end end class TestExchange < Test::Unit::TestCase context BigMoney::Exchange do setup do @aud = BigMoney.currency(:aud) @usd = BigMoney.currency(:usd) end should 'return rate' do bd = BigDecimal.new('2') assert_equal bd, BigMoney::Exchange.rate(@aud, @usd) assert_equal bd, BigMoney::Exchange.rate(:aud, :usd) assert_raise(ArgumentError) do BigMoney::Exchange.rate(:aud, :fud) end end should 'return equal rate' do assert_equal BigDecimal.new('1'), BigMoney::Exchange.rate(:usd, :usd) assert_equal BigDecimal.new('1'), BigMoney::Exchange.rate(:usd, :xxx) assert_equal BigDecimal.new('1'), BigMoney::Exchange.rate(:xxx, :usd) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
big_money-1.1.0 | test/test_exchange.rb |