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

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

require_relative '../../../../../tooling/lib/tooling/mappings/view_to_js_mappings'

RSpec.describe Tooling::Mappings::Base, feature_category: :tooling do
  describe '#folders_for_available_editions' do
    let(:base_folder_path) { 'app/views' }

    subject { described_class.new.folders_for_available_editions(base_folder_path) }

    context 'when FOSS' do
      before do
        allow(GitlabEdition).to receive(:ee?).and_return(false)
        allow(GitlabEdition).to receive(:jh?).and_return(false)
      end

      it 'returns the correct paths' do
        expect(subject).to match_array([base_folder_path])
      end
    end

    context 'when EE' do
      before do
        allow(GitlabEdition).to receive(:ee?).and_return(true)
        allow(GitlabEdition).to receive(:jh?).and_return(false)
      end

      it 'returns the correct paths' do
        expect(subject).to match_array([base_folder_path, "ee/#{base_folder_path}"])
      end
    end

    context 'when JiHu' do
      before do
        allow(GitlabEdition).to receive(:ee?).and_return(true)
        allow(GitlabEdition).to receive(:jh?).and_return(true)
      end

      it 'returns the correct paths' do
        expect(subject).to match_array([base_folder_path, "ee/#{base_folder_path}", "jh/#{base_folder_path}"])
      end
    end
  end
end