Some podmins were confuse how they can disable this redirect and I think the rule with two users can actually be a little confusing. I think the main goal of this page to give the podmin a little start and I think after they configured everything, the pod works and they found the link to the wiki to make themself an admin, it is OK to remove the redirect. Also it's bad for single-user pods where this page always stays active, even if they are an admin, but have only one user. It's more useful for single-user pods to have the login on the home page. closes #7783
72 lines
1.9 KiB
Ruby
72 lines
1.9 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# Copyright (c) 2010-2012, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
describe HomeController, type: :controller do
|
|
describe "#show" do
|
|
it "does not redirect for :html if there is at least one admin" do
|
|
expect(Role).to receive_message_chain(:admins, :any?).and_return(true)
|
|
get :show
|
|
expect(response).not_to be_redirect
|
|
end
|
|
|
|
it "redirects to the podmin page for :html if there is no admin" do
|
|
expect(Role).to receive_message_chain(:admins, :any?).and_return(false)
|
|
get :show
|
|
expect(response).to redirect_to(podmin_path)
|
|
end
|
|
|
|
it "redirects to the sign in page for :mobile" do
|
|
get :show, format: :mobile
|
|
expect(response).to redirect_to(user_session_path)
|
|
end
|
|
|
|
it "redirects to the stream if the user is signed in" do
|
|
sign_in alice
|
|
get :show
|
|
expect(response).to redirect_to(stream_path)
|
|
end
|
|
end
|
|
|
|
describe "#podmin" do
|
|
it "succeeds" do
|
|
get :podmin
|
|
expect(response).to be_success
|
|
end
|
|
|
|
it "succeeds on mobile" do
|
|
get :podmin, format: :mobile
|
|
expect(response).to be_success
|
|
end
|
|
end
|
|
|
|
describe "#toggle_mobile" do
|
|
it "changes :mobile to :html" do
|
|
session[:mobile_view] = true
|
|
get :toggle_mobile
|
|
expect(session[:mobile_view]).to be false
|
|
end
|
|
|
|
it "changes :html to :mobile" do
|
|
session[:mobile_view] = nil
|
|
get :toggle_mobile
|
|
expect(session[:mobile_view]).to be true
|
|
end
|
|
end
|
|
|
|
describe "#force_mobile" do
|
|
it "changes :html to :mobile" do
|
|
session[:mobile_view] = nil
|
|
get :force_mobile
|
|
expect(session[:mobile_view]).to be true
|
|
end
|
|
|
|
it "keeps :mobile" do
|
|
session[:mobile_view] = true
|
|
get :force_mobile
|
|
expect(session[:mobile_view]).to be true
|
|
end
|
|
end
|
|
end
|