Sha256: 40f5329ac6ba1ed72a7f0a292f37610a60de2d9112e5c4b5322882747e1e8f59

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class RoutesTest < ActionDispatch::IntegrationTest

  test "should translate routes" do
    I18n.available_locales.each do |locale|
      I18n.locale = locale

      assert_recognizes(
        { controller: 'namespace/pages', action: 'nested', locale: locale.to_s },
        "/#{locale}/#{I18n.t('routes.namespace')}/#{I18n.t('routes.nested')}"
      )

      assert_recognizes(
        { controller: 'namespace/resources', action: 'index', locale: locale.to_s },
        "/#{locale}/#{I18n.t('routes.namespace')}/#{I18n.t('routes.resources')}"
      )

      assert_recognizes(
        { controller: 'pages', action: 'simple', locale: locale.to_s },
        "/#{locale}/#{I18n.t('routes.simple')}"
      )

      assert_recognizes(
        { controller: 'pages', action: 'complex', locale: locale.to_s, p1: '1', p2: '2' },
        "/#{locale}/complex/1/2"
      )

      assert_recognizes(
        { controller: 'resources', action: 'index', locale: locale.to_s },
        "/#{locale}/#{I18n.t('routes.resources')}"
      )

    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
translatable_routes-1.3.2 test/routes_test.rb
translatable_routes-1.3.0 test/routes_test.rb