summaryrefslogtreecommitdiff
path: root/spec/features/profiles
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-04-12 22:39:18 -0700
committerStan Hu <stanhu@gmail.com>2016-04-14 07:24:58 -0700
commitc7e384aab23301ad0ee3559252324fa957d15db3 (patch)
treed78a59ec9a9da680dcc93508c92a09885069dd7c /spec/features/profiles
parent0c082d5e3a34d787f8b2fea0c22fa4256cf82be3 (diff)
downloadgitlab-ce-c7e384aab23301ad0ee3559252324fa957d15db3.tar.gz
Add spec for deletion of authorized OAuth2 application
Closes #14370 Move gon function into its own helper
Diffstat (limited to 'spec/features/profiles')
-rw-r--r--spec/features/profiles/oauth_applications_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb
new file mode 100644
index 00000000000..1a5a9059dbd
--- /dev/null
+++ b/spec/features/profiles/oauth_applications_spec.rb
@@ -0,0 +1,39 @@
+require 'spec_helper'
+
+describe 'Profile > Applications', feature: true do
+ let(:user) { create(:user) }
+
+ before do
+ login_as(user)
+ 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