diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-02-01 23:59:14 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-01 23:59:14 +0100 |
commit | e6487168ea1e0016a76e3e62f156990dd4412679 (patch) | |
tree | a8be6c33c094af653f91656225cb6beb62ad6487 /spec/models/project_auto_devops_spec.rb | |
parent | a31539847fd431e18053d0ea5a007dc38134b3f2 (diff) | |
download | gitlab-ce-e6487168ea1e0016a76e3e62f156990dd4412679.tar.gz |
Read the AutoDevOps instance domain in ProjectAutoDevOps
Diffstat (limited to 'spec/models/project_auto_devops_spec.rb')
-rw-r--r-- | spec/models/project_auto_devops_spec.rb | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/spec/models/project_auto_devops_spec.rb b/spec/models/project_auto_devops_spec.rb index 12069575866..de90080b4b8 100644 --- a/spec/models/project_auto_devops_spec.rb +++ b/spec/models/project_auto_devops_spec.rb @@ -18,7 +18,21 @@ describe ProjectAutoDevops do context 'when domain is empty' do let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: '') } - it { expect(auto_devops).not_to have_domain } + context 'when there is an instance domain specified' do + before do + stub_application_setting(auto_devops_domain: 'example.com') + end + + it { expect(auto_devops).to have_domain } + end + + context 'when there is no instance domain specified' do + before do + stub_application_setting(auto_devops_domain: nil) + end + + it { expect(auto_devops).not_to have_domain } + end end end @@ -29,9 +43,32 @@ describe ProjectAutoDevops do let(:domain) { 'example.com' } it 'returns AUTO_DEVOPS_DOMAIN' do - expect(auto_devops.variables).to include( - { key: 'AUTO_DEVOPS_DOMAIN', value: 'example.com', public: true }) + expect(auto_devops.variables).to include(domain_variable) end end + + context 'when domain is not defined' do + let(:domain) { nil } + + context 'when there is an instance domain specified' do + before do + stub_application_setting(auto_devops_domain: 'example.com') + end + + it { expect(auto_devops.variables).to include(domain_variable) } + end + + context 'when there is no instance domain specified' do + before do + stub_application_setting(auto_devops_domain: nil) + end + + it { expect(auto_devops.variables).not_to include(domain_variable) } + end + end + + def domain_variable + { key: 'AUTO_DEVOPS_DOMAIN', value: 'example.com', public: true } + end end end |