diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/pages_domain_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb index 99b7c4f148a..d2a54c3eea7 100644 --- a/spec/models/pages_domain_spec.rb +++ b/spec/models/pages_domain_spec.rb @@ -104,6 +104,14 @@ describe PagesDomain do describe 'validate certificate' do subject { domain } + context 'serverless domain' do + it 'requires certificate and key to be present' do + expect(build(:pages_domain, :without_certificate, :without_key, usage: :serverless)).not_to be_valid + expect(build(:pages_domain, :without_certificate, usage: :serverless)).not_to be_valid + expect(build(:pages_domain, :without_key, usage: :serverless)).not_to be_valid + end + end + context 'with matching key' do let(:domain) { build(:pages_domain) } @@ -555,6 +563,28 @@ describe PagesDomain do end end + describe '.instance_serverless' do + subject { described_class.instance_serverless } + + before do + create(:pages_domain, wildcard: true) + create(:pages_domain, :instance_serverless) + create(:pages_domain, scope: :instance) + create(:pages_domain, :instance_serverless) + create(:pages_domain, usage: :serverless) + end + + it 'returns domains that are wildcard, instance-level, and serverless' do + expect(subject.length).to eq(2) + + subject.each do |domain| + expect(domain.wildcard).to eq(true) + expect(domain.usage).to eq('serverless') + expect(domain.scope).to eq('instance') + end + end + end + describe '.need_auto_ssl_renewal' do subject { described_class.need_auto_ssl_renewal } |