Commit d3bdad45 authored by Matija Čupić's avatar Matija Čupić

Rename AutoDevopsHelper helper methods

parent 6e96eeb2
...@@ -9,28 +9,28 @@ module AutoDevopsHelper ...@@ -9,28 +9,28 @@ module AutoDevopsHelper
end end
def auto_devops_warning_message(project) def auto_devops_warning_message(project)
if missing_service?(project) if missing_auto_devops_service?(project)
params = { params = {
kubernetes: link_to('Kubernetes cluster', project_clusters_path(project)) kubernetes: link_to('Kubernetes cluster', project_clusters_path(project))
} }
if missing_domain?(project) if missing_auto_devops_domain?(project)
_('Auto Review Apps and Auto Deploy need a domain name and a %{kubernetes} to work correctly.') % params _('Auto Review Apps and Auto Deploy need a domain name and a %{kubernetes} to work correctly.') % params
else else
_('Auto Review Apps and Auto Deploy need a %{kubernetes} to work correctly.') % params _('Auto Review Apps and Auto Deploy need a %{kubernetes} to work correctly.') % params
end end
elsif missing_domain?(project) elsif missing_auto_devops_domain?(project)
_('Auto Review Apps and Auto Deploy need a domain name to work correctly.') _('Auto Review Apps and Auto Deploy need a domain name to work correctly.')
end end
end end
private private
def missing_domain?(project) def missing_auto_devops_domain?(project)
!(project.auto_devops&.has_domain? || current_application_settings.auto_devops_domain.present?) !(project.auto_devops&.has_domain? || current_application_settings.auto_devops_domain.present?)
end end
def missing_service?(project) def missing_auto_devops_service?(project)
!project.deployment_platform&.active? !project.deployment_platform&.active?
end end
end end
...@@ -88,12 +88,12 @@ describe AutoDevopsHelper do ...@@ -88,12 +88,12 @@ describe AutoDevopsHelper do
context 'when the service is missing' do context 'when the service is missing' do
before do before do
allow(helper).to receive(:missing_service?).and_return(true) allow(helper).to receive(:missing_auto_devops_service?).and_return(true)
end end
context 'when the domain is missing' do context 'when the domain is missing' do
before do before do
allow(helper).to receive(:missing_domain?).and_return(true) allow(helper).to receive(:missing_auto_devops_domain?).and_return(true)
end end
it { is_expected.to match(/Auto Review Apps and Auto Deploy need a domain name and a .* to work correctly./) } 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 ...@@ -101,7 +101,7 @@ describe AutoDevopsHelper do
context 'when the domain is not missing' do context 'when the domain is not missing' do
before do before do
allow(helper).to receive(:missing_domain?).and_return(false) allow(helper).to receive(:missing_auto_devops_domain?).and_return(false)
end end
it { is_expected.to match(/Auto Review Apps and Auto Deploy need a .* to work correctly./) } it { is_expected.to match(/Auto Review Apps and Auto Deploy need a .* to work correctly./) }
...@@ -110,8 +110,8 @@ describe AutoDevopsHelper do ...@@ -110,8 +110,8 @@ describe AutoDevopsHelper do
context 'when the domain is missing' do context 'when the domain is missing' do
before do before do
allow(helper).to receive(:missing_service?).and_return(false) allow(helper).to receive(:missing_auto_devops_service?).and_return(false)
allow(helper).to receive(:missing_domain?).and_return(true) allow(helper).to receive(:missing_auto_devops_domain?).and_return(true)
end end
it { is_expected.to eq('Auto Review Apps and Auto Deploy need a domain name to work correctly.') } it { is_expected.to eq('Auto Review Apps and Auto Deploy need a domain name to work correctly.') }
......
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