diff options
Diffstat (limited to 'spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb')
-rw-r--r-- | spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb new file mode 100644 index 00000000000..cb1b9e6f5fb --- /dev/null +++ b/spec/views/projects/settings/ci_cd/_autodevops_form.html.haml_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +describe 'projects/settings/ci_cd/_autodevops_form' do + let(:project) { create(:project, :repository) } + + before do + assign :project, project + end + + context 'when kubernetes is not active' do + context 'when auto devops domain is not defined' do + it 'shows warning message' do + render + + expect(rendered).to have_css('.auto-devops-warning-message') + expect(rendered).to have_text('Auto Review Apps and Auto Deploy need a domain name and a') + expect(rendered).to have_link('Kubernetes cluster') + end + end + + context 'when auto devops domain is defined' do + before do + project.build_auto_devops(domain: 'example.com') + end + + it 'shows warning message' do + render + + expect(rendered).to have_css('.auto-devops-warning-message') + expect(rendered).to have_text('Auto Review Apps and Auto Deploy need a') + expect(rendered).to have_link('Kubernetes cluster') + end + end + end + + context 'when kubernetes is active' do + before do + create(:kubernetes_service, project: project) + end + + context 'when auto devops domain is not defined' do + it 'shows warning message' do + render + + expect(rendered).to have_css('.auto-devops-warning-message') + expect(rendered).to have_text('Auto Review Apps and Auto Deploy need a domain name to work correctly.') + end + end + + context 'when auto devops domain is defined' do + before do + project.build_auto_devops(domain: 'example.com') + end + + it 'does not show warning message' do + render + + expect(rendered).not_to have_css('.auto-devops-warning-message') + end + end + end +end |