Sha256: 6b2291f75bd26875ce4a1836d2852b7c44b06a9a5be02cbb8b4e6807ce26cd65
Contents?: true
Size: 1.93 KB
Versions: 7
Compression:
Stored size: 1.93 KB
Contents
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../lib") require 'money/core_extensions' require 'money/variable_exchange_bank' require 'money/money' require 'money/micro_money' describe "to_money core extensions for" do specify "Numeric works" do money = 1234.to_money money.cents.should == 1234_00 money.currency.should == Money.default_currency money = 100.37.to_money money.cents.should == 100_37 money.currency.should == Money.default_currency end specify "String works" do "100".to_money.should == Money.new(100_00) "100.37".to_money.should == Money.new(100_37) "100,37".to_money.should == Money.new(100_37) "100 000".to_money.should == Money.new(100_000_00) "100 USD".to_money.should == Money.new(100_00, "USD") "-100 USD".to_money.should == Money.new(-100_00, "USD") "100 EUR".to_money.should == Money.new(100_00, "EUR") "100.37 EUR".to_money.should == Money.new(100_37, "EUR") "100,37 EUR".to_money.should == Money.new(100_37, "EUR") "USD 100".to_money.should == Money.new(100_00, "USD") "EUR 100".to_money.should == Money.new(100_00, "EUR") "EUR 100.37".to_money.should == Money.new(100_37, "EUR") "CAD -100.37".to_money.should == Money.new(-100_37, "CAD") "EUR 100,37".to_money.should == Money.new(100_37, "EUR") "EUR -100,37".to_money.should == Money.new(-100_37, "EUR") "$100 USD".to_money.should == Money.new(100_00, "USD") end end describe "Convenience methods on Numeric and String should return" do specify "1.millicent" do 1.millicent.should == MicroMoney.new(1) end specify "100.millcents" do 100.millicents.should == MicroMoney.new(100) end specify "1.cent" do 1.cent.should == Money.new(1) end specify "100.cents" do 100.cents.should == Money.new(100) end specify "1.dollar" do 1.dollar.should == Money.new(100) end specify "100.dollars" do 100.dollars.should == Money.new(10000) end end
Version data entries
7 entries across 7 versions & 1 rubygems