summaryrefslogtreecommitdiff
path: root/spec/services/resource_access_tokens
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/services/resource_access_tokens
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/services/resource_access_tokens')
-rw-r--r--spec/services/resource_access_tokens/create_service_spec.rb23
-rw-r--r--spec/services/resource_access_tokens/revoke_service_spec.rb2
2 files changed, 23 insertions, 2 deletions
diff --git a/spec/services/resource_access_tokens/create_service_spec.rb b/spec/services/resource_access_tokens/create_service_spec.rb
index 57e7e4e66de..f22c379cd30 100644
--- a/spec/services/resource_access_tokens/create_service_spec.rb
+++ b/spec/services/resource_access_tokens/create_service_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe ResourceAccessTokens::CreateService do
+RSpec.describe ResourceAccessTokens::CreateService do
subject { described_class.new(user, resource, params).execute }
let_it_be(:user) { create(:user) }
@@ -45,6 +45,27 @@ describe ResourceAccessTokens::CreateService do
expect(access_token.user.reload.user_type).to eq("#{resource_type}_bot")
end
+ context 'email confirmation status' do
+ shared_examples_for 'creates a user that has their email confirmed' do
+ it 'creates a user that has their email confirmed' do
+ response = subject
+ access_token = response.payload[:access_token]
+
+ expect(access_token.user.reload.confirmed?).to eq(true)
+ end
+ end
+
+ context 'when created by an admin' do
+ it_behaves_like 'creates a user that has their email confirmed' do
+ let(:user) { create(:admin) }
+ end
+ end
+
+ context 'when created by a non-admin' do
+ it_behaves_like 'creates a user that has their email confirmed'
+ end
+ end
+
context 'bot name' do
context 'when no value is passed' do
it 'uses default value' do
diff --git a/spec/services/resource_access_tokens/revoke_service_spec.rb b/spec/services/resource_access_tokens/revoke_service_spec.rb
index 3ce82745b9e..ffc06d770f8 100644
--- a/spec/services/resource_access_tokens/revoke_service_spec.rb
+++ b/spec/services/resource_access_tokens/revoke_service_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe ResourceAccessTokens::RevokeService do
+RSpec.describe ResourceAccessTokens::RevokeService do
subject { described_class.new(user, resource, access_token).execute }
let_it_be(:user) { create(:user) }