debian-mirror-gitlab/spec/features/profiles/user_manages_applications_spec.rb

58 lines
1.7 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-27 19:54:05 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'User manages applications' do
2018-03-27 19:54:05 +05:30
let(:user) { create(:user) }
before do
sign_in(user)
visit applications_profile_path
end
it 'manages applications' do
expect(page).to have_content 'Add new application'
fill_in :doorkeeper_application_name, with: 'test'
fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
2020-09-03 11:15:55 +05:30
check :doorkeeper_application_scopes_read_user
2018-03-27 19:54:05 +05:30
click_on 'Save application'
expect(page).to have_content 'Application: test'
2018-12-05 23:21:45 +05:30
expect(page).to have_content 'Application ID'
2018-03-27 19:54:05 +05:30
expect(page).to have_content 'Secret'
2020-03-13 15:44:24 +05:30
expect(page).to have_content 'Confidential Yes'
2018-03-27 19:54:05 +05:30
click_on 'Edit'
expect(page).to have_content 'Edit application'
fill_in :doorkeeper_application_name, with: 'test_changed'
2020-03-13 15:44:24 +05:30
uncheck :doorkeeper_application_confidential
2018-03-27 19:54:05 +05:30
click_on 'Save application'
expect(page).to have_content 'test_changed'
2018-12-05 23:21:45 +05:30
expect(page).to have_content 'Application ID'
2018-03-27 19:54:05 +05:30
expect(page).to have_content 'Secret'
2020-03-13 15:44:24 +05:30
expect(page).to have_content 'Confidential No'
2018-03-27 19:54:05 +05:30
visit applications_profile_path
page.within '.oauth-applications' do
click_on 'Destroy'
end
expect(page.find('.oauth-applications')).not_to have_content 'test_changed'
end
2020-09-03 11:15:55 +05:30
context 'when scopes are blank' do
it 'returns an error' do
expect(page).to have_content 'Add new application'
fill_in :doorkeeper_application_name, with: 'test'
fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
click_on 'Save application'
expect(page).to have_content("Scopes can't be blank")
end
end
2018-03-27 19:54:05 +05:30
end