+ def test_logout_with_token
+ token = users(:normal_user).tokens.create
+
+ session[:token] = token.token
+
+ get :logout
+ assert_response :success
+ assert_template :logout
+ assert_select "input[name=referer][value=?]", ""
+ assert_equal token.token, session[:token]
+ assert_not_nil UserToken.where(:id => token.id).first
+
+ session_id = assert_select("input[name=session]").first["value"]
+
+ get :logout, :session => session_id
+ assert_response :redirect
+ assert_redirected_to root_path
+ assert_nil session[:token]
+ assert_nil UserToken.where(:id => token.id).first
+ end
+