summaryrefslogtreecommitdiff
path: root/spec/controllers/admin/cohorts_controller_spec.rb
blob: 9eb2a713517705390265b4d7c921378b781cb502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Admin::CohortsController do
  context 'as admin' do
    let(:user) { create(:admin) }

    before do
      sign_in(user)
    end

    it 'renders 200' do
      get :index

      expect(response).to have_gitlab_http_status(:success)
    end

    describe 'GET #index' do
      it_behaves_like 'tracking unique visits', :index do
        let(:target_id) { 'i_analytics_cohorts' }
      end
    end
  end

  context 'as normal user' do
    let(:user) { create(:user) }

    before do
      sign_in(user)
    end

    it 'renders a 404' do
      get :index

      expect(response).to have_gitlab_http_status(:not_found)
    end
  end
end