mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 23:59:40 +02:00
Update hard-coded currency UI with currency specific params (#488)
* Update hard-coded currency UI with currency specific params * Rename extension methods to match currency option names; Move cents extension to numeric class extension * Use currency's precision to show the cents part in accounts show page --------- Co-authored-by: Sriram Krishnan <sriram@seafoodsouq.com>
This commit is contained in:
parent
1968fb0145
commit
7e883c4439
6 changed files with 78 additions and 5 deletions
19
test/initializers/string_extensions_test.rb
Normal file
19
test/initializers/string_extensions_test.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# test/string_extensions_test.rb
|
||||
require "test_helper"
|
||||
|
||||
class StringExtensionsTest < ActiveSupport::TestCase
|
||||
test "#unit returns the currency unit for a given currency code" do
|
||||
assert_equal "$", "USD".unit
|
||||
assert_equal "€", "EUR".unit
|
||||
end
|
||||
|
||||
test "#separator returns the currency separator for a given currency code" do
|
||||
assert_equal ".", "USD".separator
|
||||
assert_equal ",", "EUR".separator
|
||||
end
|
||||
|
||||
test "#precision returns the currency's precision for a given currency code" do
|
||||
assert_equal 2, "USD".precision
|
||||
assert_equal 0, "KRW".precision
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue