diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-27 12:05:20 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-27 12:05:20 +0300 |
commit | efc5fbfd77f086fc39553e3b03e52e25e0eec24a (patch) | |
tree | e3477f399b62f1df70dae3b8dbcbc4afda0296d1 /spec | |
parent | 018f7e46c79195cbac9e92a7bcc76434f0cf7390 (diff) | |
parent | f8de6d65f85a086f903a2389347ebde47d1a5494 (diff) |
Merge branch '34282-fix-api-using-include_missing-false' into 'master'
Fix optional arugments for POST :id/variables
Closes #34282
See merge request !12474
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/variables_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb index 83673864fe7..e0975024b80 100644 --- a/spec/requests/api/variables_spec.rb +++ b/spec/requests/api/variables_spec.rb @@ -82,6 +82,17 @@ describe API::Variables do expect(json_response['protected']).to be_truthy end + it 'creates variable with optional attributes' do + expect do + post api("/projects/#{project.id}/variables", user), key: 'TEST_VARIABLE_2', value: 'VALUE_2' + end.to change{project.variables.count}.by(1) + + expect(response).to have_http_status(201) + expect(json_response['key']).to eq('TEST_VARIABLE_2') + expect(json_response['value']).to eq('VALUE_2') + expect(json_response['protected']).to be_falsey + end + it 'does not allow to duplicate variable key' do expect do post api("/projects/#{project.id}/variables", user), key: variable.key, value: 'VALUE_2' |