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

user_reads_pipeline_status_spec.rb « files « projects « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18a5fb71b10c86cec121930902bf87be0466c305 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'user reads pipeline status', :js, feature_category: :projects do
  let(:project) { create(:project, :repository) }
  let(:user) { create(:user) }
  let(:v110_pipeline) { create_pipeline('v1.1.0', 'success') }
  let(:x110_pipeline) { create_pipeline('x1.1.0', 'failed') }

  before do
    project.add_maintainer(user)

    project.repository.add_tag(user, 'x1.1.0', 'v1.1.0')
    v110_pipeline
    x110_pipeline

    sign_in(user)
  end

  shared_examples 'visiting project tree' do
    it 'sees the correct pipeline status' do
      visit project_tree_path(project, expected_pipeline.ref)
      wait_for_requests

      page.within('.commit-detail') do
        expect(page).to have_link('', href: project_pipeline_path(project, expected_pipeline))
        expect(page).to have_selector(".ci-status-icon-#{expected_pipeline.status}")
      end
    end
  end

  it_behaves_like 'visiting project tree' do
    let(:expected_pipeline) { v110_pipeline }
  end

  it_behaves_like 'visiting project tree' do
    let(:expected_pipeline) { x110_pipeline }
  end

  def create_pipeline(ref, status)
    create(:ci_pipeline,
      project: project,
      ref: ref,
      sha: project.commit(ref).sha,
      status: status)
  end
end