Sha256: 1c80c1178bf7022aead6bba4598148afa46e4a5ef19e87dae1bdf1f6ef5c4684
Contents?: true
Size: 955 Bytes
Versions: 2
Compression:
Stored size: 955 Bytes
Contents
require 'test_helper' class SelectionTest < ActionController::TestCase tests SimplesController test "should select correct locale by subdomain" do Rails.application.config.i18n_routes.selection = :subdomain subdomains = [] Rails.application.config.i18n_routes.mapping.each_pair do |lang, countries| countries = [countries] unless countries.is_a? Array countries.each do |country| @request.host = "#{country}.example.org" get :show assert_equal I18n.locale.to_s, "#{lang}-#{country.upcase}" subdomains << country end end assert_equal @controller.send(:subdomains), subdomains end test "should select correct locale by prefix" do Rails.application.config.i18n_routes.selection = :prefix I18n.available_locales.select{|l|l!=:en}.each do |locale| get :show, :locale => locale.to_s assert_equal I18n.locale.to_s, locale.to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_i18n_routes-1.1.9 | test/selection_test.rb |
rails_i18n_routes-1.1.8 | test/selection_test.rb |