Commit 1292c158 authored by Matija Čupić's avatar Matija Čupić

Update CI Variable presenters paths

parent 2592aec9
...@@ -7,19 +7,15 @@ module Ci ...@@ -7,19 +7,15 @@ module Ci
end end
def form_path def form_path
if variable.persisted? group_settings_ci_cd_path(group)
group_variable_path(group, variable)
else
group_variables_path(group)
end
end end
def edit_path def edit_path
group_variable_path(group, variable) group_variables_save_multiple_path(group)
end end
def delete_path def delete_path
group_variable_path(group, variable) group_variables_save_multiple_path(group)
end end
end end
end end
...@@ -7,19 +7,15 @@ module Ci ...@@ -7,19 +7,15 @@ module Ci
end end
def form_path def form_path
if variable.persisted? project_settings_ci_cd_path(project)
project_variable_path(project, variable)
else
project_variables_path(project)
end
end end
def edit_path def edit_path
project_variable_path(project, variable) project_variables_save_multiple_path(project)
end end
def delete_path def delete_path
project_variable_path(project, variable) project_variables_save_multiple_path(project)
end end
end end
end end
...@@ -35,29 +35,20 @@ describe Ci::GroupVariablePresenter do ...@@ -35,29 +35,20 @@ describe Ci::GroupVariablePresenter do
end end
describe '#form_path' do describe '#form_path' do
context 'when variable is persisted' do subject { described_class.new(variable).form_path }
subject { described_class.new(variable).form_path }
it { is_expected.to eq(group_variable_path(group, variable)) } it { is_expected.to eq(group_settings_ci_cd_path(group)) }
end
context 'when variable is not persisted' do
let(:variable) { build(:ci_group_variable, group: group) }
subject { described_class.new(variable).form_path }
it { is_expected.to eq(group_variables_path(group)) }
end
end end
describe '#edit_path' do describe '#edit_path' do
subject { described_class.new(variable).edit_path } subject { described_class.new(variable).edit_path }
it { is_expected.to eq(group_variable_path(group, variable)) } it { is_expected.to eq(group_variables_save_multiple_path(group)) }
end end
describe '#delete_path' do describe '#delete_path' do
subject { described_class.new(variable).delete_path } subject { described_class.new(variable).delete_path }
it { is_expected.to eq(group_variable_path(group, variable)) } it { is_expected.to eq(group_variables_save_multiple_path(group)) }
end end
end end
...@@ -35,29 +35,20 @@ describe Ci::VariablePresenter do ...@@ -35,29 +35,20 @@ describe Ci::VariablePresenter do
end end
describe '#form_path' do describe '#form_path' do
context 'when variable is persisted' do subject { described_class.new(variable).form_path }
subject { described_class.new(variable).form_path }
it { is_expected.to eq(project_variable_path(project, variable)) } it { is_expected.to eq(project_settings_ci_cd_path(project)) }
end
context 'when variable is not persisted' do
let(:variable) { build(:ci_variable, project: project) }
subject { described_class.new(variable).form_path }
it { is_expected.to eq(project_variables_path(project)) }
end
end end
describe '#edit_path' do describe '#edit_path' do
subject { described_class.new(variable).edit_path } subject { described_class.new(variable).edit_path }
it { is_expected.to eq(project_variable_path(project, variable)) } it { is_expected.to eq(project_variables_save_multiple_path(project)) }
end end
describe '#delete_path' do describe '#delete_path' do
subject { described_class.new(variable).delete_path } subject { described_class.new(variable).delete_path }
it { is_expected.to eq(project_variable_path(project, variable)) } it { is_expected.to eq(project_variables_save_multiple_path(project)) }
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