3 class PageLocaleTest < ActionDispatch::IntegrationTest
14 user = create(:user, :languages => [])
16 post "/login", :params => { :username => user.email, :password => "test" }
20 assert_equal [], User.find(user.id).languages
21 assert_select "html[lang=?]", "en"
23 get "/diary/new", :headers => { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
24 assert_equal %w[fr en], User.find(user.id).languages
25 assert_select "html[lang=?]", "fr"
29 user = create(:user, :languages => ["de"])
32 assert_select "html[lang=?]", "en"
34 get "/diary", :params => { :locale => "es" }
35 assert_select "html[lang=?]", "es"
37 post "/login", :params => { :username => user.email, :password => "test" }
41 assert_select "html[lang=?]", "de"
43 get "/diary", :params => { :locale => "fr" }
44 assert_select "html[lang=?]", "fr"