BigW Consortium Gitlab

applications_controller_spec.rb 746 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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

15
        expect(response).to have_gitlab_http_status(200)
16 17 18 19 20 21 22 23
      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

24
        expect(response).to have_gitlab_http_status(302)
25 26 27 28 29
        expect(response).to redirect_to(profile_path)
      end
    end
  end
end