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

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

require 'spec_helper'

RSpec.describe MilestonesHelper do
  let_it_be(:issuable) { build(:merge_request) }

  describe '#milestone_header_class' do
    using RSpec::Parameterized::TableSyntax

    color_primary = 'gl-bg-blue-500 gl-text-white'
    border_empty = 'gl-border-bottom-0 gl-rounded-base'

    where(:primary, :issuables, :header_color, :header_border) do
      true  | [issuable] | color_primary | ''
      true  | []         | color_primary | border_empty
      false | []         | ''            | border_empty
      false | [issuable] | ''            | ''
    end

    with_them do
      subject { helper.milestone_header_class(primary, issuables) }

      it { is_expected.to eq("#{header_color} #{header_border} gl-display-flex") }
    end
  end

  describe '#milestone_counter_class' do
    context 'when primary is set to true' do
      subject { helper.milestone_counter_class(true) }

      it { is_expected.to eq('gl-text-white') }
    end

    context 'when primary is set to false' do
      subject { helper.milestone_counter_class(false) }

      it { is_expected.to eq('gl-text-gray-500') }
    end
  end
end