Sha256: ba7adfca78657be4eac18623b0e30de9c2acbcf0c61578be0ceade5d8c1a9d25

Contents?: true

Size: 973 Bytes

Versions: 47

Compression:

Stored size: 973 Bytes

Contents

require 'abstract_unit'

class TranslationHelperTest < Test::Unit::TestCase
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::TranslationHelper
  
  attr_reader :request
  def setup
  end
  
  def test_delegates_to_i18n_setting_the_raise_option
    I18n.expects(:translate).with(:foo, :locale => 'en', :raise => true)
    translate :foo, :locale => 'en'
  end
  
  def test_returns_missing_translation_message_wrapped_into_span
    expected = '<span class="translation_missing">en, foo</span>'
    assert_equal expected, translate(:foo)
  end

  def test_delegates_localize_to_i18n
    @time = Time.utc(2008, 7, 8, 12, 18, 38)
    I18n.expects(:localize).with(@time)
    localize @time
  end
  
  def test_scoping_by_partial
    expects(:template).returns(stub(:path_without_format_and_extension => "people/index"))
    I18n.expects(:translate).with("people.index.foo", :locale => 'en', :raise => true)
    translate ".foo", :locale => 'en'
  end
end

Version data entries

47 entries across 46 versions & 13 rubygems

Version Path
elkinsware-erubis_rails_helper-0.6.0 test/template/translation_helper_test.rb
elkinsware-erubis_rails_helper-0.6.1 test/template/translation_helper_test.rb
elkinsware-erubis_rails_helper-0.9.0 test/template/translation_helper_test.rb
elkinsware-erubis_rails_helper-0.9.1 test/template/translation_helper_test.rb
elkinsware-erubis_rails_helper-0.9.5 test/template/translation_helper_test.rb
ghazel-erubis_rails_helper-0.9.5 test/template/translation_helper_test.rb
actionpack_csi-2.3.5.p8 test/template/translation_helper_test.rb
actionpack_csi-2.3.5.p7 test/template/translation_helper_test.rb
actionpack_csi-2.3.5.p6 test/template/translation_helper_test.rb
mitio-erubis_rails_helper-1.0.1 test/template/translation_helper_test.rb
webroar-0.5.0 src/admin_panel/vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.2.4 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.2.2 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.2.1 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.2 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.1.9 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.1.8 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.1.7 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.1.6 vendor/rails/actionpack/test/template/translation_helper_test.rb
radiantcms-couchrest_model-0.1.5 vendor/rails/actionpack/test/template/translation_helper_test.rb