We only want to render the account link and login items in the header. And we want only render the Multitenancy and Administrators sections in the admin sidebar. We include the administrators management so it's possible to give permissions to other users to manage tenants. In order to restrict access to other sections by typing the URL or following a link, we're only enabling the rest of the routes when we aren't in the multitenancy management mode.
29 lines
801 B
Ruby
29 lines
801 B
Ruby
require "rails_helper"
|
|
|
|
describe "Multitenancy management mode", :admin do
|
|
before do
|
|
allow(Rails.application.config).to receive(:multitenancy_management_mode).and_return(true)
|
|
Setting["org_name"] = "CONSUL"
|
|
end
|
|
|
|
scenario "renders expected content for multitenancy manage mode in admin section" do
|
|
visit admin_root_path
|
|
|
|
within ".top-links" do
|
|
expect(page).not_to have_content "Go back to CONSUL"
|
|
end
|
|
|
|
within ".top-bar" do
|
|
expect(page).to have_css "li", count: 2
|
|
expect(page).to have_content "My account"
|
|
expect(page).to have_content "Sign out"
|
|
end
|
|
|
|
within "#admin_menu" do
|
|
expect(page).to have_content "Multitenancy"
|
|
expect(page).to have_content "Administrators"
|
|
expect(page).to have_css "li", count: 2
|
|
end
|
|
end
|
|
end
|