instiki/vendor/rails/actionpack/test/template/form_options_helper_i18n_test.rb
Jacques Distler 4bdf703ab2 Instiki 0.17.2: Security Release
This release upgrades Instiki to Rails 2.3.4, which
patches two security holes in Rails. See

  http://weblog.rubyonrails.org/2009/9/4/ruby-on-rails-2-3-4

There are also some new features, and the usual boatload
of bugfixes. See the CHANGELOG for details.
2009-09-05 02:01:46 -05:00

27 lines
848 B
Ruby

require 'abstract_unit'
class FormOptionsHelperI18nTests < ActionView::TestCase
tests ActionView::Helpers::FormOptionsHelper
def setup
@prompt_message = 'Select!'
I18n.backend.send(:init_translations)
I18n.backend.store_translations :en, :support => { :select => { :prompt => @prompt_message } }
end
def teardown
I18n.backend = I18n::Backend::Simple.new
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