Validate format of subdomains / schema names
Note we're using the `:HOST` regular expression since subdomains can contain the same characters as domains do. This isn't 100% precise, though, since subdomains have a maximum length of 63 characters, but is good enough for our purposes.
This commit is contained in:
@@ -25,6 +25,16 @@ describe Tenant do
|
||||
end
|
||||
end
|
||||
|
||||
it "is valid with nested subdomains" do
|
||||
tenant.schema = "multiple.sub.domains"
|
||||
expect(tenant).to be_valid
|
||||
end
|
||||
|
||||
it "is not valid with an invalid subdomain" do
|
||||
tenant.schema = "my sub domain"
|
||||
expect(tenant).not_to be_valid
|
||||
end
|
||||
|
||||
it "is not valid without a name" do
|
||||
tenant.name = ""
|
||||
expect(tenant).not_to be_valid
|
||||
|
||||
Reference in New Issue
Block a user