diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-01-13 05:36:04 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-05 20:57:43 +0300 |
commit | ba077841922089c0eb2bbb48947de8828f891776 (patch) | |
tree | 557eef632e82cc106a272c64376f065990ad326a /spec/controllers/projects | |
parent | c64181ce4c57bc7ffbbcc51ee9bf0001bf83e1b1 (diff) |
Add destroy functionality to save_multiple
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/variables_controller_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb index e0294fd4a46..87463f00b8f 100644 --- a/spec/controllers/projects/variables_controller_spec.rb +++ b/spec/controllers/projects/variables_controller_spec.rb @@ -110,5 +110,25 @@ describe Projects::VariablesController do expect(response).to have_gitlab_http_status(:ok) end end + + context 'with a deleted variable' do + subject do + post :save_multiple, + namespace_id: project.namespace.to_param, project_id: project, + variables: [{ key: variable.key, value: variable.value, _destroy: 'true' }], + format: :json + end + + it 'destroys the variable' do + expect { subject }.to change { project.variables.count }.by(-1) + expect { variable.reload }.to raise_error ActiveRecord::RecordNotFound + end + + it 'returns a successful response' do + subject + + expect(response).to have_gitlab_http_status(:ok) + end + end end end |