#to_money should accept currency as second optional argument #11

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

Comments

Projects
None yet
2 participants
@valodzka

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

This comment has been minimized.

Show comment Hide comment
@semmons99

semmons99 Jul 9, 2010

Member

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

Member

semmons99 commented Jul 9, 2010

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

@semmons99

This comment has been minimized.

Show comment Hide comment
@semmons99

semmons99 Jul 9, 2010

Member

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

Member

semmons99 commented Jul 9, 2010

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