diff options
Diffstat (limited to 'spec/requests/api/ci/variables_spec.rb')
-rw-r--r-- | spec/requests/api/ci/variables_spec.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/requests/api/ci/variables_spec.rb b/spec/requests/api/ci/variables_spec.rb index e937c4c2b8f..a1446e1040e 100644 --- a/spec/requests/api/ci/variables_spec.rb +++ b/spec/requests/api/ci/variables_spec.rb @@ -48,6 +48,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do expect(json_response['masked']).to eq(variable.masked?) expect(json_response['raw']).to eq(variable.raw?) expect(json_response['variable_type']).to eq('env_var') + expect(json_response['description']).to be_nil end it 'responds with 404 Not Found if requesting non-existing variable' do @@ -140,7 +141,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do it 'creates variable with optional attributes' do expect do - post api("/projects/#{project.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2' } + post api("/projects/#{project.id}/variables", user), params: { variable_type: 'file', key: 'TEST_VARIABLE_2', value: 'VALUE_2', description: 'description' } end.to change { project.variables.count }.by(1) expect(response).to have_gitlab_http_status(:created) @@ -150,6 +151,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do expect(json_response['masked']).to be_falsey expect(json_response['raw']).to be_falsey expect(json_response['variable_type']).to eq('file') + expect(json_response['description']).to eq('description') end it 'does not allow to duplicate variable key' do @@ -226,7 +228,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do initial_variable = project.variables.reload.first value_before = initial_variable.value - put api("/projects/#{project.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true } + put api("/projects/#{project.id}/variables/#{variable.key}", user), params: { variable_type: 'file', value: 'VALUE_1_UP', protected: true, description: 'updated' } updated_variable = project.variables.reload.first @@ -235,6 +237,7 @@ RSpec.describe API::Ci::Variables, feature_category: :secrets_management do expect(updated_variable.value).to eq('VALUE_1_UP') expect(updated_variable).to be_protected expect(updated_variable.variable_type).to eq('file') + expect(updated_variable.description).to eq('updated') end it 'masks the new value when logging' do |