Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#to_money should accept currency as second optional argument #11

Closed
valodzka opened this issue Jul 8, 2010 · 2 comments
Closed

#to_money should accept currency as second optional argument #11

valodzka opened this issue Jul 8, 2010 · 2 comments

Comments

@valodzka
Copy link

valodzka commented Jul 8, 2010

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
@semmons99
Copy link
Member

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

@semmons99
Copy link
Member

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

Losangelosgenetics pushed a commit to Losangelosgenetics/money that referenced this issue Mar 13, 2020
include EUR in CURRENCIES table
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants