aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/number_helper_i18n_test.rb
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2008-06-19 16:25:27 +0200
committerSven Fuchs <svenfuchs@artweb-design.de>2008-06-19 16:25:27 +0200
commit45d41f0dadd9fa171f306ff356770c4492726f30 (patch)
tree44829d24de330827d53e52c328b5dc8d81244656 /actionpack/test/template/number_helper_i18n_test.rb
parent40557e17dda0525d5d26c09b3279b83695df3f4d (diff)
downloadrails-45d41f0dadd9fa171f306ff356770c4492726f30.tar.gz
rails-45d41f0dadd9fa171f306ff356770c4492726f30.tar.bz2
rails-45d41f0dadd9fa171f306ff356770c4492726f30.zip
integrating I18n into Rails
Diffstat (limited to 'actionpack/test/template/number_helper_i18n_test.rb')
-rw-r--r--actionpack/test/template/number_helper_i18n_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/template/number_helper_i18n_test.rb b/actionpack/test/template/number_helper_i18n_test.rb
new file mode 100644
index 0000000000..47cb035f56
--- /dev/null
+++ b/actionpack/test/template/number_helper_i18n_test.rb
@@ -0,0 +1,27 @@
+require 'abstract_unit'
+
+class NumberHelperI18nTests < Test::Unit::TestCase
+ include ActionView::Helpers::NumberHelper
+
+ attr_reader :request
+ def setup
+ @request = mock
+ @defaults = {:separator => ".", :unit => "$", :format => "%u%n", :delimiter => ",", :precision => 2}
+ I18n.backend.add_translations 'en-US', :currency => {:format => @defaults}
+ end
+
+ def test_number_to_currency_given_a_locale_it_does_not_check_request_for_locale
+ request.expects(:locale).never
+ number_to_currency(1, :locale => 'en-US')
+ end
+
+ def test_number_to_currency_given_no_locale_it_checks_request_for_locale
+ request.expects(:locale).returns 'en-US'
+ number_to_currency(1)
+ end
+
+ def test_number_to_currency_translates_currency_formats
+ I18n.expects(:translate).with(:'currency.format', 'en-US').returns @defaults
+ number_to_currency(1, :locale => 'en-US')
+ end
+end \ No newline at end of file