diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-01 22:43:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-01 22:43:06 +0000 |
commit | d40003afdea391c2d1396f3ab6c78705fa6d2a79 (patch) | |
tree | 9db27e723a5ce38b50106da5ef878453cbf4f990 /spec/services | |
parent | a986819a7bce2002018dfafed3900dc3f2e8fb81 (diff) | |
download | gitlab-ce-d40003afdea391c2d1396f3ab6c78705fa6d2a79.tar.gz |
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.rb | 19 |
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 |