summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-03 23:30:05 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-06 16:34:20 +0900
commit00bee8d967ff74c5fde61f2cc3d3ecb5593f8274 (patch)
tree4f611f6c00e92856bc0c37764125c5fa78d86920
parentf5be4ed9f0c59cb9c406a60fa8775655e4ccb004 (diff)
downloadgitlab-ce-00bee8d967ff74c5fde61f2cc3d3ecb5593f8274.tar.gz
Use include Gitlab::Routing.url_helpers for presenter spec
-rw-r--r--spec/presenters/ci/group_variable_presenter_spec.rb14
-rw-r--r--spec/presenters/ci/variable_presenter_spec.rb14
2 files changed, 12 insertions, 16 deletions
diff --git a/spec/presenters/ci/group_variable_presenter_spec.rb b/spec/presenters/ci/group_variable_presenter_spec.rb
index ed34edaf18f..d404028405b 100644
--- a/spec/presenters/ci/group_variable_presenter_spec.rb
+++ b/spec/presenters/ci/group_variable_presenter_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe Ci::GroupVariablePresenter do
+ include Gitlab::Routing.url_helpers
+
let(:group) { create(:group) }
let(:variable) { create(:ci_group_variable, group: group) }
@@ -34,32 +36,28 @@ describe Ci::GroupVariablePresenter do
describe '#form_path' do
context 'when variable is persisted' do
- let(:path) { "/groups/#{group.name}/variables/#{variable.id}" }
subject { described_class.new(variable).form_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(group_variable_path(group, variable)) }
end
context 'when variable is not persisted' do
- let(:path) { "/groups/#{group.name}/variables" }
let(:variable) { build(:ci_group_variable, group: group) }
subject { described_class.new(variable).form_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(group_variables_path(group)) }
end
end
describe '#edit_path' do
- let(:path) { "/groups/#{group.name}/variables/#{variable.id}" }
subject { described_class.new(variable).edit_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(group_variable_path(group, variable)) }
end
describe '#delete_path' do
- let(:path) { "/groups/#{group.name}/variables/#{variable.id}" }
subject { described_class.new(variable).delete_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(group_variable_path(group, variable)) }
end
end
diff --git a/spec/presenters/ci/variable_presenter_spec.rb b/spec/presenters/ci/variable_presenter_spec.rb
index efabd74d678..3b615c4bf36 100644
--- a/spec/presenters/ci/variable_presenter_spec.rb
+++ b/spec/presenters/ci/variable_presenter_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe Ci::VariablePresenter do
+ include Gitlab::Routing.url_helpers
+
let(:project) { create(:empty_project) }
let(:variable) { create(:ci_variable, project: project) }
@@ -34,32 +36,28 @@ describe Ci::VariablePresenter do
describe '#form_path' do
context 'when variable is persisted' do
- let(:path) { "/#{project.namespace.name}/#{project.name}/variables/#{variable.id}" }
subject { described_class.new(variable).form_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(namespace_project_variable_path(project.namespace, project, variable)) }
end
context 'when variable is not persisted' do
let(:variable) { build(:ci_variable, project: project) }
- let(:path) { "/#{project.namespace.name}/#{project.name}/variables" }
subject { described_class.new(variable).form_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(namespace_project_variables_path(project.namespace, project)) }
end
end
describe '#edit_path' do
- let(:path) { "/#{project.namespace.name}/#{project.name}/variables/#{variable.id}" }
subject { described_class.new(variable).edit_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(namespace_project_variable_path(project.namespace, project, variable)) }
end
describe '#delete_path' do
- let(:path) { "/#{project.namespace.name}/#{project.name}/variables/#{variable.id}" }
subject { described_class.new(variable).delete_path }
- it { is_expected.to eq(path) }
+ it { is_expected.to eq(namespace_project_variable_path(project.namespace, project, variable)) }
end
end