require "test_helper"
class PageLocaleTest < ActionDispatch::IntegrationTest
- fixtures :users
-
def setup
I18n.locale = "en"
stub_hostip_requests
end
def test_defaulting
- user = users(:second_public_user)
+ user = create(:user, :languages => [])
post_via_redirect "/login", :username => user.email, :password => "test"
assert_select "html[lang=?]", "en"
get "/diary/new", {}, { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
- assert_equal %w(fr en), User.find(user.id).languages
+ assert_equal %w[fr en], User.find(user.id).languages
assert_select "html[lang=?]", "fr"
end
def test_override
- user = users(:german_user)
+ user = create(:user, :languages => ["de"])
get "/diary"
assert_select "html[lang=?]", "en"