summaryrefslogtreecommitdiff
path: root/spec/services/applications/create_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/applications/create_service_spec.rb')
-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