2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Profile > Applications' do
|
2016-06-02 11:05:42 +05:30
|
|
|
let(:user) { create(:user) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:application) { create(:oauth_application, owner: user) }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
before do
|
2021-12-11 22:18:48 +05:30
|
|
|
stub_feature_flags(bootstrap_confirmation_modals: false)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'User manages applications', :js do
|
|
|
|
it 'views an application' do
|
|
|
|
visit oauth_application_path(application)
|
|
|
|
|
|
|
|
expect(page).to have_content("Application: #{application.name}")
|
2022-07-16 23:28:13 +05:30
|
|
|
expect(find('[data-testid="breadcrumb-current-link"]')).to have_link(application.name)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
it 'deletes an application' do
|
|
|
|
create(:oauth_application, owner: user)
|
|
|
|
visit oauth_applications_path
|
|
|
|
|
|
|
|
page.within('.oauth-applications') do
|
|
|
|
expect(page).to have_content('Your applications (1)')
|
2018-03-17 18:26:18 +05:30
|
|
|
accept_confirm { click_button 'Destroy' }
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('The application was deleted successfully')
|
|
|
|
expect(page).to have_content('Your applications (0)')
|
|
|
|
expect(page).to have_content('Authorized applications (0)')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'deletes an authorized application' do
|
|
|
|
create(:oauth_access_token, resource_owner: user)
|
|
|
|
visit oauth_applications_path
|
|
|
|
|
|
|
|
page.within('.oauth-authorized-applications') do
|
|
|
|
expect(page).to have_content('Authorized applications (1)')
|
2018-03-17 18:26:18 +05:30
|
|
|
accept_confirm { click_button 'Revoke' }
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('The application was revoked access.')
|
|
|
|
expect(page).to have_content('Your applications (0)')
|
|
|
|
expect(page).to have_content('Authorized applications (0)')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|