3 class PageLocaleTest < ActionDispatch::IntegrationTest
14 user = create(:user, :languages => [])
16 post_via_redirect "/login", :username => user.email, :password => "test"
19 assert_equal [], User.find(user.id).languages
20 assert_select "html[lang=?]", "en"
22 get "/diary/new", {}, { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
23 assert_equal %w[fr en], User.find(user.id).languages
24 assert_select "html[lang=?]", "fr"
28 user = create(:user, :languages => ["de"])
31 assert_select "html[lang=?]", "en"
33 get "/diary", :locale => "es"
34 assert_select "html[lang=?]", "es"
36 post_via_redirect "/login", :username => user.email, :password => "test"
39 assert_select "html[lang=?]", "de"
41 get "/diary", :locale => "fr"
42 assert_select "html[lang=?]", "fr"