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

timelogs_controller_spec.rb « time_tracking « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68eecf9b137e62990b19da41233c78051c9079f4 (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
40
41
42
43
44
45
46
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe TimeTracking::TimelogsController, feature_category: :team_planning do
  let_it_be(:user) { create(:user) }

  describe 'GET #index' do
    subject { get timelogs_path }

    context 'when user is not logged in' do
      it 'responds with a redirect to the login page' do
        subject

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

    context 'when user is logged in' do
      before do
        sign_in(user)
      end

      context 'when global_time_tracking_report FF is enabled' do
        it 'responds with the global time tracking page', :aggregate_failures do
          subject

          expect(response).to have_gitlab_http_status(:ok)
          expect(response).to render_template(:index)
        end
      end

      context 'when global_time_tracking_report FF is disable' do
        before do
          stub_feature_flags(global_time_tracking_report: false)
        end

        it 'returns a 404 page' do
          subject

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