diff options
author | Akira Matsuda <ronnie@dio.jp> | 2009-08-26 14:00:06 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-26 11:29:16 -0700 |
commit | adedf72821a5623227ce91e6b298838e692477e4 (patch) | |
tree | f2de096228c4c74b915311d0314f64bdb8b749ff /actionpack/test | |
parent | 9408fcd2e858ae48dd30d9e8d1bb1dcbbfffb840 (diff) | |
download | rails-adedf72821a5623227ce91e6b298838e692477e4.tar.gz rails-adedf72821a5623227ce91e6b298838e692477e4.tar.bz2 rails-adedf72821a5623227ce91e6b298838e692477e4.zip |
I18n: use I18n for select helpers' prompt text
[#2252 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_options_helper_i18n_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/template/form_options_helper_i18n_test.rb b/actionpack/test/template/form_options_helper_i18n_test.rb new file mode 100644 index 0000000000..4f25d41fc9 --- /dev/null +++ b/actionpack/test/template/form_options_helper_i18n_test.rb @@ -0,0 +1,22 @@ +require 'abstract_unit' + +class FormOptionsHelperI18nTests < ActionView::TestCase + tests ActionView::Helpers::FormOptionsHelper + + def setup + @prompt_message = 'Select!' + I18n.backend.store_translations :en, :support => { :select => { :prompt => @prompt_message} } + end + + def test_select_with_prompt_true_translates_prompt_message + I18n.expects(:translate).with('support.select.prompt', { :default => 'Please select' }) + select 'post', 'category', [], :prompt => true + end + + def test_select_with_translated_prompt + assert_dom_equal( + %Q(<select id="post_category" name="post[category]"><option value="">#{@prompt_message}</option>\n</select>), + select('post', 'category', [], :prompt => true) + ) + end +end
\ No newline at end of file |