Commit 27b4290f authored by Alishan Ladhani's avatar Alishan Ladhani

Add default values for wildcard and domain_type

parent 86fa482a
......@@ -26,6 +26,8 @@ class PagesDomain < ApplicationRecord
validate :validate_intermediates, if: ->(domain) { domain.certificate.present? && domain.certificate_changed? }
default_value_for(:auto_ssl_enabled, allow_nil: false) { ::Gitlab::LetsEncrypt.enabled? }
default_value_for :domain_type, allow_nil: false, value: :project
default_value_for :wildcard, allow_nil: false, value: false
attr_encrypted :key,
mode: :per_attribute_iv_and_salt,
......
......@@ -175,6 +175,16 @@ describe PagesDomain do
it { is_expected.to validate_presence_of(:verification_code) }
end
describe 'default values' do
it 'defaults wildcard to false' do
expect(subject.wildcard).to eq(false)
end
it 'defaults domain_type to project' do
expect(subject.domain_type).to eq('project')
end
end
describe '#verification_code' do
subject { pages_domain.verification_code }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment