diff options
Diffstat (limited to 'spec/models/pages_domain_spec.rb')
-rw-r--r-- | spec/models/pages_domain_spec.rb | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/spec/models/pages_domain_spec.rb b/spec/models/pages_domain_spec.rb index 5a4eca11f71..7aa5cf993dc 100644 --- a/spec/models/pages_domain_spec.rb +++ b/spec/models/pages_domain_spec.rb @@ -84,20 +84,20 @@ RSpec.describe PagesDomain, feature_category: :pages do attributes = attributes_for(:pages_domain) cert, key = attributes.fetch_values(:certificate, :key) - true | nil | nil | false | %i(certificate key) + true | nil | nil | false | %i[certificate key] true | nil | nil | true | [] - true | cert | nil | false | %i(key) - true | cert | nil | true | %i(key) - true | nil | key | false | %i(certificate key) - true | nil | key | true | %i(key) + true | cert | nil | false | %i[key] + true | cert | nil | true | %i[key] + true | nil | key | false | %i[certificate key] + true | nil | key | true | %i[key] true | cert | key | false | [] true | cert | key | true | [] false | nil | nil | false | [] false | nil | nil | true | [] - false | cert | nil | false | %i(key) - false | cert | nil | true | %i(key) - false | nil | key | false | %i(key) - false | nil | key | true | %i(key) + false | cert | nil | false | %i[key] + false | cert | nil | true | %i[key] + false | nil | key | false | %i[key] + false | nil | key | true | %i[key] false | cert | key | false | [] false | cert | key | true | [] end @@ -288,8 +288,8 @@ RSpec.describe PagesDomain, feature_category: :pages do end end - describe '#has_intermediates?' do - subject { domain.has_intermediates? } + describe '#has_valid_intermediates?' do + subject { domain.has_valid_intermediates? } context 'for self signed' do let(:domain) { build(:pages_domain) } @@ -312,6 +312,14 @@ RSpec.describe PagesDomain, feature_category: :pages do it { is_expected.to be_truthy } end + + context 'for chain with unknown root CA' do + # In cases where users use an origin certificate the CA does not necessarily need to be in + # the trust store, eg. in the case of Cloudflare Origin Certs. + let(:domain) { build(:pages_domain, :with_untrusted_root_ca_in_chain) } + + it { is_expected.to be_truthy } + end end describe '#expired?' do |