summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/ci/pipeline_editor_controller_spec.rb
blob: d55aad20689e4904e178454ede476fa944e6f040 (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
47
48
49
50
51
52
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Projects::Ci::PipelineEditorController do
  let_it_be(:project) { create(:project, :repository) }
  let_it_be(:user) { create(:user) }

  subject(:show_request) { get :show, params: { namespace_id: project.namespace, project_id: project } }

  before do
    sign_in(user)
  end

  describe 'GET #show' do
    context 'with enough privileges' do
      before do
        project.add_developer(user)
        show_request
      end

      it { expect(response).to have_gitlab_http_status(:ok) }

      it 'renders show page' do
        expect(response).to render_template :show
      end
    end

    context 'without enough privileges' do
      before do
        project.add_reporter(user)
        show_request
      end

      it 'responds with 404' do
        expect(response).to have_gitlab_http_status(:not_found)
      end
    end

    describe 'pipeline_editor_walkthrough experiment' do
      before do
        project.add_developer(user)
      end

      subject(:action) { show_request }

      it_behaves_like 'tracks assignment and records the subject', :pipeline_editor_walkthrough, :namespace do
        subject { project.namespace }
      end
    end
  end
end