diff options
author | Stan Hu <stanhu@gmail.com> | 2016-06-08 09:15:45 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-06-08 15:52:04 +0300 |
commit | 3b50d96b8aaa7e18efded9a80c7641d1364de5c9 (patch) | |
tree | 8db3cd9db648e3d7c6802027cd470a4c73c71698 /spec | |
parent | 703026c03e3967831cb61f09fa983fca3e0b1d1b (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')
-rw-r--r-- | spec/controllers/oauth/applications_controller_spec.rb | 29 |
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 |