Some institutions using CONSUL have expressed interest in this feature since some of their tenants might already have their own domains. We've considered many options for the user interface to select whether we're using a subdomain or a domain, like having two separate fields, using a check box, ... In the end we've chosen radio buttons because they make it easier to follow a logical sequence: first you decide whether you're introducing a domain or subdomain, and then you enter it. We've also considered hiding this option and assuming "if it's got a dot, it's a domain". However, this wouldn't work with nested subdomains and it wouldn't work with domains which are simply machine names. Note that a group of radio buttons (or check boxes) is difficult to style when the text of the label might expand over more than one line (as is the case here on small screens); in this case, most solutions result in the second line of the label appearing immediately under the radio button, instead of being aligned with the first line of the label. That's why I've added a container for the input+label combination.
31 lines
690 B
Ruby
31 lines
690 B
Ruby
require "rails_helper"
|
|
|
|
describe TenantVariants do
|
|
controller(ActionController::Base) do
|
|
include TenantVariants
|
|
|
|
def index
|
|
render plain: request.variant
|
|
end
|
|
end
|
|
|
|
it "uses the default tenant by default" do
|
|
get :index
|
|
expect(response.body).to eq "[:public]"
|
|
end
|
|
|
|
it "uses the current tenant schema when defined" do
|
|
allow(Tenant).to receive(:current_schema).and_return("random-name")
|
|
|
|
get :index
|
|
expect(response.body).to eq '[:"random-name"]'
|
|
end
|
|
|
|
it "keeps dots in the variant names" do
|
|
allow(Tenant).to receive(:current_schema).and_return("random.domain")
|
|
|
|
get :index
|
|
expect(response.body).to eq '[:"random.domain"]'
|
|
end
|
|
end
|