Commit 9bed20d2 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add specs for warning message shown in Auto DevOps settings

parent 30176977
...@@ -9,9 +9,17 @@ describe ProjectAutoDevops do ...@@ -9,9 +9,17 @@ describe ProjectAutoDevops do
it { is_expected.to respond_to(:updated_at) } it { is_expected.to respond_to(:updated_at) }
describe '#has_domain?' do describe '#has_domain?' do
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: 'domain.com') } context 'when domain is defined' do
let(:auto_devops) { build_stubbed(:project_auto_devops, project: project, domain: 'domain.com') }
it { expect(auto_devops).to have_domain }
end
it { is_expected.to have_domain } 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 }
end
end end
describe '#variables' do describe '#variables' do
......
require 'spec_helper'
describe 'projects/pipelines_settings/_show' 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('.settings-message')
expect(rendered).to have_text('Auto Review Apps and Auto Deploy need a domain name and the')
expect(rendered).to have_link('Kubernetes service')
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('.settings-message')
expect(rendered).to have_text('Auto Review Apps and Auto Deploy need the')
expect(rendered).to have_link('Kubernetes service')
end
end
end
context 'when kubernetes is active' do
before do
project.build_kubernetes_service(active: true)
end
context 'when auto devops domain is not defined' do
it 'shows warning message' do
render
expect(rendered).to have_css('.settings-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('.settings-message')
end
end
end
end
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