diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-19 10:31:46 -0500 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-20 12:18:41 -0500 |
commit | 800ee75aa5f65fc41f32c8d7f3519256cd37c645 (patch) | |
tree | 7c4eb77281c943d13e9894577bc2755f4ec72e76 /spec/models | |
parent | 0dd6d25c251beffca510094281ac8403fad6d8d0 (diff) | |
download | gitlab-ce-800ee75aa5f65fc41f32c8d7f3519256cd37c645.tar.gz |
Ensure deploy tokens variables are not available in the context of only/except
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/build_spec.rb | 11 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index e70f5b26440..9620e644032 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2041,7 +2041,7 @@ describe Ci::Build do let(:deploy_token_variables) do [ - { key: 'CI_DEPLOY_USER', value: DeployToken::GITLAB_DEPLOY_TOKEN_NAME, public: true }, + { key: 'CI_DEPLOY_USER', value: deploy_token.name, public: true }, { key: 'CI_DEPLOY_PASSWORD', value: deploy_token.token, public: true } ] end @@ -2058,9 +2058,8 @@ describe Ci::Build do context 'when gitlab-deploy-token does not exist' do it 'should not include deploy token variables' do - %w(CI_DEPLOY_USER CI_DEPLOY_PASSWORD).each do |deploy_token_key| - expect(subject.find { |v| v[:key] == deploy_token_key}).to be_nil - end + expect(subject.find { |v| v[:key] == 'CI_DEPLOY_USER'}).to be_nil + expect(subject.find { |v| v[:key] == 'CI_DEPLOY_PASSWORD'}).to be_nil end end end @@ -2112,7 +2111,9 @@ describe Ci::Build do CI_REGISTRY_USER CI_REGISTRY_PASSWORD CI_REPOSITORY_URL - CI_ENVIRONMENT_URL] + CI_ENVIRONMENT_URL + CI_DEPLOY_USER + CI_DEPLOY_PASSWORD] build.scoped_variables.map { |env| env[:key] }.tap do |names| expect(names).not_to include(*keys) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index f8b2fbf7399..bae2f1342d3 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -3612,7 +3612,7 @@ describe Project do it { is_expected.to be_nil } end - context 'when there is a gitlab deploy token associated with a different name' do + context 'when there is a deploy token associated with a different name' do let!(:deploy_token) { create(:deploy_token, projects: [project]) } it { is_expected.to be_nil } |