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

detailed_status_type_spec.rb « ci « types « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 686461cb9a59234dd19f4c4417f44e154e21cd54 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Types::Ci::DetailedStatusType do
  include GraphqlHelpers

  specify { expect(described_class.graphql_name).to eq('DetailedStatus') }

  it 'has all fields' do
    expect(described_class).to have_graphql_fields(:id, :group, :icon, :favicon,
                                                   :details_path, :has_details,
                                                   :label, :text, :tooltip, :action)
  end

  let_it_be(:stage) { create(:ci_stage, status: :skipped) }

  describe 'id field' do
    it 'correctly renders the field' do
      status = stage.detailed_status(stage.pipeline.user)
      expected_id = "#{status.id}-#{stage.id}"

      expect(resolve_field('id', status, extras: { parent: stage }, arg_style: :internal)).to eq(expected_id)
    end
  end

  describe 'action field' do
    it 'correctly renders the field' do
      status = stage.detailed_status(stage.pipeline.user)

      expected_status = {
          button_title: status.action_button_title,
          icon: status.action_icon,
          method: status.action_method,
          path: status.action_path,
          title: status.action_title
        }

      expect(resolve_field('action', status, arg_style: :internal)).to eq(expected_status)
    end
  end
end