Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-06-08 09:15:45 +0300
committerStan Hu <stanhu@gmail.com>2016-06-08 15:52:04 +0300
commit3b50d96b8aaa7e18efded9a80c7641d1364de5c9 (patch)
tree8db3cd9db648e3d7c6802027cd470a4c73c71698 /spec/controllers
parent703026c03e3967831cb61f09fa983fca3e0b1d1b (diff)
Fix endless redirections when accessing user OAuth applications when they are disabled
Also hides the "Applications" nav button if OAuth applications are disabled by the admin. Closes #14770
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/oauth/applications_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb
new file mode 100644
index 00000000000..af378304893
--- /dev/null
+++ b/spec/controllers/oauth/applications_controller_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe Oauth::ApplicationsController do
+ let(:user) { create(:user) }
+
+ context 'project members' do
+ before do
+ sign_in(user)
+ end
+
+ describe 'GET #index' do
+ it 'shows list of applications' do
+ get :index
+
+ expect(response.status).to eq(200)
+ end
+
+ it 'redirects back to profile page if OAuth applications are disabled' do
+ settings = double(user_oauth_applications?: false)
+ allow_any_instance_of(Gitlab::CurrentSettings).to receive(:current_application_settings).and_return(settings)
+
+ get :index
+
+ expect(response.status).to eq(302)
+ expect(response).to redirect_to(profile_path)
+ end
+ end
+ end
+end