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

blame_mode_spec.rb « git « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3496b763f924dfec01a50dd84c34d401fa4d7fc1 (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
53
54
55
56
57
58
59
60
61
62
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Git::BlameMode, feature_category: :source_code_management do
  subject(:blame_mode) { described_class.new(project, params) }

  let_it_be(:project) { build(:project) }
  let(:params) { {} }

  describe '#streaming?' do
    subject { blame_mode.streaming? }

    it { is_expected.to be_falsey }

    context 'when streaming param is provided' do
      let(:params) { { streaming: true } }

      it { is_expected.to be_truthy }
    end
  end

  describe '#pagination?' do
    subject { blame_mode.pagination? }

    it { is_expected.to be_truthy }

    context 'when `streaming` params is enabled' do
      let(:params) { { streaming: true } }

      it { is_expected.to be_falsey }
    end

    context 'when `no_pagination` param is provided' do
      let(:params) { { no_pagination: true } }

      it { is_expected.to be_falsey }
    end

    context 'when `blame_page_pagination` is disabled' do
      before do
        stub_feature_flags(blame_page_pagination: false)
      end

      it { is_expected.to be_falsey }
    end
  end

  describe '#full?' do
    subject { blame_mode.full? }

    it { is_expected.to be_falsey }

    context 'when `blame_page_pagination` is disabled' do
      before do
        stub_feature_flags(blame_page_pagination: false)
      end

      it { is_expected.to be_truthy }
    end
  end
end