Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 23:02:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 23:02:30 +0300
commit41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch)
tree9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/services/groups/deploy_tokens/revoke_service_spec.rb
parent0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff)
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/services/groups/deploy_tokens/revoke_service_spec.rb')
-rw-r--r--spec/services/groups/deploy_tokens/revoke_service_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/groups/deploy_tokens/revoke_service_spec.rb b/spec/services/groups/deploy_tokens/revoke_service_spec.rb
new file mode 100644
index 00000000000..fcf11bbb8e6
--- /dev/null
+++ b/spec/services/groups/deploy_tokens/revoke_service_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Groups::DeployTokens::RevokeService do
+ let_it_be(:entity) { create(:group) }
+ let_it_be(:deploy_token) { create(:deploy_token, :group, groups: [entity]) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:deploy_token_params) { { id: deploy_token.id } }
+
+ describe '#execute' do
+ subject { described_class.new(entity, user, deploy_token_params).execute }
+
+ it "revokes a group deploy token" do
+ expect(deploy_token.revoked).to eq(false)
+
+ expect { subject }.to change { deploy_token.reload.revoked }.to eq(true)
+ end
+
+ context 'invalid token id' do
+ let(:deploy_token_params) { { token_id: non_existing_record_id } }
+
+ it 'raises an error' do
+ expect { subject }.to raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+ end
+end