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>2020-09-02 01:43:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-02 01:43:06 +0300
commitd40003afdea391c2d1396f3ab6c78705fa6d2a79 (patch)
tree9db27e723a5ce38b50106da5ef878453cbf4f990 /spec/services
parenta986819a7bce2002018dfafed3900dc3f2e8fb81 (diff)
Add latest changes from gitlab-org/security/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/applications/create_service_spec.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/services/applications/create_service_spec.rb b/spec/services/applications/create_service_spec.rb
index 58ac723ee55..8b8beb057a9 100644
--- a/spec/services/applications/create_service_spec.rb
+++ b/spec/services/applications/create_service_spec.rb
@@ -6,9 +6,24 @@ RSpec.describe ::Applications::CreateService do
include TestRequestHelpers
let(:user) { create(:user) }
- let(:params) { attributes_for(:application) }
subject { described_class.new(user, params) }
- it { expect { subject.execute(test_request) }.to change { Doorkeeper::Application.count }.by(1) }
+ context 'when scopes are present' do
+ let(:params) { attributes_for(:application, scopes: ['read_user']) }
+
+ it { expect { subject.execute(test_request) }.to change { Doorkeeper::Application.count }.by(1) }
+ end
+
+ context 'when scopes are missing' do
+ let(:params) { attributes_for(:application) }
+
+ it { expect { subject.execute(test_request) }.not_to change { Doorkeeper::Application.count } }
+
+ it 'includes blank scopes error message' do
+ application = subject.execute(test_request)
+
+ expect(application.errors.full_messages).to include "Scopes can't be blank"
+ end
+ end
end