diff options
| author | Matija Čupić <matteeyah@gmail.com> | 2018-02-01 21:58:05 +0100 |
|---|---|---|
| committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-05 18:58:20 +0100 |
| commit | 558057010f02fc931db08d8dedfc7cdeb6192ecb (patch) | |
| tree | dc199976b8d68e3c30a7c6cf705c62a6975fd447 /spec/controllers/groups | |
| parent | c95c3ffc9e4f1992929899bfc21440b621cc8daf (diff) | |
| download | gitlab-ce-558057010f02fc931db08d8dedfc7cdeb6192ecb.tar.gz | |
Extract variable parameters in VariablesController specs
Diffstat (limited to 'spec/controllers/groups')
| -rw-r--r-- | spec/controllers/groups/variables_controller_spec.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/controllers/groups/variables_controller_spec.rb b/spec/controllers/groups/variables_controller_spec.rb index f6bcc68f9ad..94d13b632cd 100644 --- a/spec/controllers/groups/variables_controller_spec.rb +++ b/spec/controllers/groups/variables_controller_spec.rb @@ -25,16 +25,22 @@ describe Groups::VariablesController do describe 'POST #update' do let!(:variable) { create(:ci_group_variable, group: group) } + 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 context 'with invalid new variable parameters' do subject do patch :update, group_id: group, - 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 @@ -57,11 +63,8 @@ describe Groups::VariablesController do subject do patch :update, group_id: group, - 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 @@ -90,10 +93,7 @@ describe Groups::VariablesController do subject do patch :update, group_id: group, - 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 |
