2016-04-13 01:39:18 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
describe 'Profile > Applications' do
|
2016-04-13 01:39:18 -04:00
|
|
|
let(:user) { create(:user) }
|
2018-01-01 08:55:52 -05:00
|
|
|
let(:application) { create(:oauth_application, owner: user) }
|
2016-04-13 01:39:18 -04:00
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-04-13 01:39:18 -04:00
|
|
|
end
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
describe 'User manages applications', :js do
|
2018-01-01 08:55:52 -05:00
|
|
|
it 'views an application' do
|
|
|
|
visit oauth_application_path(application)
|
|
|
|
|
|
|
|
expect(page).to have_content("Application: #{application.name}")
|
|
|
|
expect(find('.breadcrumbs-sub-title')).to have_link(application.name)
|
|
|
|
end
|
|
|
|
|
2016-04-13 01:39:18 -04:00
|
|
|
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)')
|
2017-10-24 11:21:09 -04:00
|
|
|
accept_confirm { click_button 'Destroy' }
|
2016-04-13 01:39:18 -04:00
|
|
|
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)')
|
2017-10-24 11:21:09 -04:00
|
|
|
accept_confirm { click_button 'Revoke' }
|
2016-04-13 01:39:18 -04:00
|
|
|
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
|