Skip to content
This repository

#to_money should accept currency as second optional argument #11

Closed
valodzka opened this Issue July 08, 2010 · 2 comments

2 participants

valodzka Shane Emmons
valodzka

Something like this:

describe "Money core extensions" do
  specify "#to_money accept currency" do
    %w{EUR USD}.each do |curr|
      money = 1234.to_money(curr)
      money.cents.should == 1234_00
      money.currency.should == Money::Currency.new(curr)
      money.should == Money.new(1234_00, curr)

      money = "10.10".to_money(curr)
      money.cents.should = 10_10
      money.currency.should == Money::Currency.new(curr)
      money.should == Money.new(10_10, curr)

      '10 JPY'.to_money(curr).should == Money.new(10_00, curr) # or raise?
    end
  end
end
Shane Emmons
Owner

commit bad6f51 adds support for optional currency argument in Numeric#to_money

Shane Emmons
Owner

commit 04fcbd2 adds support for optional currency argument in String#to_money

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.