From a31539847fd431e18053d0ea5a007dc38134b3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Thu, 1 Feb 2018 23:29:11 +0100 Subject: Add specs for .auto_devops_warning_message --- spec/helpers/auto_devops_helper_spec.rb | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'spec/helpers/auto_devops_helper_spec.rb') diff --git a/spec/helpers/auto_devops_helper_spec.rb b/spec/helpers/auto_devops_helper_spec.rb index 5e272af6073..1fcbad5875d 100644 --- a/spec/helpers/auto_devops_helper_spec.rb +++ b/spec/helpers/auto_devops_helper_spec.rb @@ -82,4 +82,39 @@ describe AutoDevopsHelper do it { is_expected.to eq(false) } end end + + describe '.auto_devops_warning_message' do + subject { helper.auto_devops_warning_message(project) } + + context 'when the service is missing' do + before do + allow(helper).to receive(:missing_service?).and_return(true) + end + + context 'when the domain is missing' do + before do + allow(helper).to receive(:missing_domain?).and_return(true) + end + + it { is_expected.to match(/Auto Review Apps and Auto Deploy need a domain name and a .* to work correctly./) } + end + + context 'when the domain is not missing' do + before do + allow(helper).to receive(:missing_domain?).and_return(false) + end + + it { is_expected.to match(/Auto Review Apps and Auto Deploy need a .* to work correctly./) } + end + end + + context 'when the domain is missing' do + before do + allow(helper).to receive(:missing_service?).and_return(false) + allow(helper).to receive(:missing_domain?).and_return(true) + end + + it { is_expected.to eq('Auto Review Apps and Auto Deploy need a domain name to work correctly.') } + end + end end -- cgit v1.2.1 From 3443f3eb125186679afcbca2d58943e288691f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Fri, 2 Feb 2018 19:54:00 +0100 Subject: Rename AutoDevopsHelper helper methods --- spec/helpers/auto_devops_helper_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/helpers/auto_devops_helper_spec.rb') diff --git a/spec/helpers/auto_devops_helper_spec.rb b/spec/helpers/auto_devops_helper_spec.rb index 1fcbad5875d..1950c2b129b 100644 --- a/spec/helpers/auto_devops_helper_spec.rb +++ b/spec/helpers/auto_devops_helper_spec.rb @@ -88,12 +88,12 @@ describe AutoDevopsHelper do context 'when the service is missing' do before do - allow(helper).to receive(:missing_service?).and_return(true) + allow(helper).to receive(:missing_auto_devops_service?).and_return(true) end context 'when the domain is missing' do before do - allow(helper).to receive(:missing_domain?).and_return(true) + allow(helper).to receive(:missing_auto_devops_domain?).and_return(true) end it { is_expected.to match(/Auto Review Apps and Auto Deploy need a domain name and a .* to work correctly./) } @@ -101,7 +101,7 @@ describe AutoDevopsHelper do context 'when the domain is not missing' do before do - allow(helper).to receive(:missing_domain?).and_return(false) + allow(helper).to receive(:missing_auto_devops_domain?).and_return(false) end it { is_expected.to match(/Auto Review Apps and Auto Deploy need a .* to work correctly./) } @@ -110,8 +110,8 @@ describe AutoDevopsHelper do context 'when the domain is missing' do before do - allow(helper).to receive(:missing_service?).and_return(false) - allow(helper).to receive(:missing_domain?).and_return(true) + allow(helper).to receive(:missing_auto_devops_service?).and_return(false) + allow(helper).to receive(:missing_auto_devops_domain?).and_return(true) end it { is_expected.to eq('Auto Review Apps and Auto Deploy need a domain name to work correctly.') } -- cgit v1.2.1