Sha256: d9fc7c9db565f2860866057bce510143aefb3ea71545bcdbfee660d72bc2ba17
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../lib") require 'money/core_extensions' describe "Money core extensions" do specify "Numberic#to_money 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#to_money 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
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
jmcnevin-money-2.0.0 | test/core_extensions_spec.rb |
jmcnevin-money-2.0.1 | test/core_extensions_spec.rb |
sevenwire-money-2.0.0 | test/core_extensions_spec.rb |