2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'Profile > Applications' do
|
2016-06-02 11:05:42 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'User manages applications', js: true do
|
|
|
|
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)')
|
|
|
|
click_button 'Destroy'
|
|
|
|
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)')
|
|
|
|
click_button 'Revoke'
|
|
|
|
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
|