diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 18:21:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-21 18:21:10 +0300 |
commit | e33f87ac0fabaab468ce4b457996cc0f1b1bb648 (patch) | |
tree | 8bf0de72a9acac014cfdaddab7d463b208294af2 /spec/support/shared_examples/controllers | |
parent | 5baf990db20a75078684702782c24399ef9eb0fa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/controllers')
-rw-r--r-- | spec/support/shared_examples/controllers/deploy_token_shared_examples.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/support/shared_examples/controllers/deploy_token_shared_examples.rb b/spec/support/shared_examples/controllers/deploy_token_shared_examples.rb index 791eb0b68e0..bd4eeff81a0 100644 --- a/spec/support/shared_examples/controllers/deploy_token_shared_examples.rb +++ b/spec/support/shared_examples/controllers/deploy_token_shared_examples.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true RSpec.shared_examples 'a created deploy token' do + let(:read_repository) { '1' } let(:deploy_token_params) do { name: 'deployer_token', expires_at: 1.month.from_now.to_date.to_s, username: 'deployer', - read_repository: '1', + read_repository: read_repository, deploy_token_type: deploy_token_type } end @@ -19,4 +20,15 @@ RSpec.shared_examples 'a created deploy token' do expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template(:show) end + + context 'when no scope is selected' do + let(:read_repository) { '0' } + + it 'creates a variable with a errored deploy token' do + expect { create_deploy_token }.not_to change { DeployToken.active.count } + + expect(assigns(:new_deploy_token)).to be_a(DeployToken) + expect(assigns(:new_deploy_token).errors.full_messages.first).to eq('Scopes can\'t be blank') + end + end end |