Skip to content

Commit

Permalink
Test that operations propagate format options
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Feb 10, 2021
1 parent be4e29c commit 5a157f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/money_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,16 @@ defmodule MoneyTest do
Application.put_env(:ex_money, :default_cldr_backend, money_backend)
Application.put_env(:ex_cldr, :default_backend, cldr_backend)
end

test "that format options propogate through operations" do
format_options = [fractional_digits: 4]
money = Money.new!(:USD, 100)
money_with_options = Money.new!(:USD, 100, format_options)

assert Money.add!(money, money_with_options).format_options == format_options
assert Money.sub!(money, money_with_options).format_options == format_options
assert Money.mult!(money_with_options, 3).format_options == format_options
assert Money.div!(money_with_options, 3).format_options == format_options

end
end

0 comments on commit 5a157f9

Please sign in to comment.