Sha256: 0739cacc75b460d6f0c09c63ae909f73ec399d2cd8f21ffa3f03754f30499943

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module Tests
  module Backend
    module Api
      module Link
        def test_translate_calls_translate_if_resolves_to_a_symbol
          setup_linked_translations
          assert_equal 'foo', I18n.backend.translate('en', :link_to_foo)
        end

        def test_translate_calls_translate_if_resolves_to_a_symbol2
          setup_linked_translations
          assert_equal('baz', I18n.backend.translate('en', :link_to_baz))
        end

        def test_translate_calls_translate_if_resolves_to_a_symbol3
          setup_linked_translations
          assert I18n.backend.translate('en', :link_to_bar).key?(:baz)
        end

        def test_translate_calls_translate_if_resolves_to_a_symbol_with_scope_1
          setup_linked_translations
          assert_equal('baz', I18n.backend.translate('en', :link_to_baz, :scope => :bar))
        end

        def test_translate_calls_translate_if_resolves_to_a_symbol_with_scope_1
          setup_linked_translations
          assert_equal('buz', I18n.backend.translate('en', :'bar.link_to_buz'))
        end

        private
  
          def setup_linked_translations
            I18n.backend.store_translations 'en', {
              :foo => 'foo',
              :bar => { :baz => 'baz', :link_to_baz => :baz, :link_to_buz => :'boz.buz' },
              :boz => { :buz => 'buz' },
              :link_to_foo => :foo,
              :link_to_bar => :bar,
              :link_to_baz => :'bar.baz'
            }
          end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
svenfuchs-i18n-0.2.0 test/api/link.rb
theoooo-i18n-0.2.0 test/api/link.rb
theoooo-i18n-0.2.1 test/api/link.rb
theoooo-i18n-0.2.2 test/api/link.rb
i18n-0.2.1 test/api/link.rb