Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-02-01 23:58:05 +0300
committerMatija Čupić <matteeyah@gmail.com>2018-02-05 20:58:20 +0300
commit558057010f02fc931db08d8dedfc7cdeb6192ecb (patch)
treedc199976b8d68e3c30a7c6cf705c62a6975fd447 /spec/controllers/projects
parentc95c3ffc9e4f1992929899bfc21440b621cc8daf (diff)
Extract variable parameters in VariablesController specs
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/variables_controller_spec.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb
index 8e5d6023b79..4dbcfb125a2 100644
--- a/spec/controllers/projects/variables_controller_spec.rb
+++ b/spec/controllers/projects/variables_controller_spec.rb
@@ -30,6 +30,15 @@ describe Projects::VariablesController do
describe 'POST #update' do
let(:variable) { create(:ci_variable) }
+ let(:variable_attributes) do
+ { id: variable.id, key: variable.key,
+ value: variable.value,
+ protected: variable.protected?.to_s }
+ end
+ let(:new_variable_attributes) do
+ { key: 'new_key', value: 'dummy_value',
+ protected: 'false' }
+ end
before do
project.variables << variable
@@ -39,11 +48,8 @@ describe Projects::VariablesController do
subject do
patch :update,
namespace_id: project.namespace.to_param, project_id: project,
- variables_attributes: [{ id: variable.id, key: variable.key,
- value: 'other_value',
- protected: variable.protected?.to_s },
- { key: '..?', value: 'dummy_value',
- protected: 'false' }],
+ variables_attributes: [variable_attributes.merge(value: 'other_value'),
+ new_variable_attributes.merge(key: '..?')],
format: :json
end
@@ -66,11 +72,8 @@ describe Projects::VariablesController do
subject do
patch :update,
namespace_id: project.namespace.to_param, project_id: project,
- variables_attributes: [{ id: variable.id, key: variable.key,
- value: 'other_value',
- protected: variable.protected?.to_s },
- { key: 'new_key', value: 'dummy_value',
- protected: 'false' }],
+ variables_attributes: [variable_attributes.merge(value: 'other_value'),
+ new_variable_attributes],
format: :json
end
@@ -99,10 +102,7 @@ describe Projects::VariablesController do
subject do
patch :update,
namespace_id: project.namespace.to_param, project_id: project,
- variables_attributes: [{ id: variable.id, key: variable.key,
- value: variable.value,
- protected: variable.protected?.to_s,
- _destroy: 'true' }],
+ variables_attributes: [variable_attributes.merge(_destroy: 'true')],
format: :json
end