From c7e6777961239224e28171a46c9768db881c5506 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 16 May 2010 18:00:08 -0300 Subject: Added default currency values to NumberHelper and pass them to I18n.translate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4604 state:committed] Signed-off-by: José Valim --- actionpack/test/template/number_helper_i18n_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'actionpack/test/template/number_helper_i18n_test.rb') diff --git a/actionpack/test/template/number_helper_i18n_test.rb b/actionpack/test/template/number_helper_i18n_test.rb index f730a0d7f5..8561019461 100644 --- a/actionpack/test/template/number_helper_i18n_test.rb +++ b/actionpack/test/template/number_helper_i18n_test.rb @@ -45,6 +45,12 @@ class NumberHelperTest < ActionView::TestCase assert_equal("&$ - 10.00", number_to_currency(10, :locale => 'ts')) end + def test_number_to_currency_with_clean_i18n_settings + clean_i18n do + assert_equal("$10.00", number_to_currency(10)) + end + end + def test_number_with_precision #Delimiter was set to "" assert_equal("10000", number_with_precision(10000, :locale => 'ts')) @@ -92,4 +98,15 @@ class NumberHelperTest < ActionView::TestCase #Significant was set to true with precision 2, with custom translated units assert_equal "4.3 cm", number_to_human(0.0432, :locale => 'ts', :units => :custom_units_for_number_to_human) end + + private + def clean_i18n + load_path = I18n.load_path.dup + I18n.load_path.clear + I18n.reload! + yield + ensure + I18n.load_path = load_path + I18n.reload! + end end -- cgit v1.2.3