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

reader_spec.rb « import_export « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 802c00bed74ed676ad09b636ca3cf3918f6cbd91 (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'

describe Gitlab::ImportExport::Reader do
  let(:shared) { Gitlab::ImportExport::Shared.new(nil) }

  describe '#project_tree' do
    subject { described_class.new(shared: shared).project_tree }

    it 'delegates to AttributesFinder#find_root' do
      expect_any_instance_of(Gitlab::ImportExport::AttributesFinder)
        .to receive(:find_root)
        .with(:project)

      subject
    end

    context 'when exception raised' do
      before do
        expect_any_instance_of(Gitlab::ImportExport::AttributesFinder)
          .to receive(:find_root)
          .with(:project)
          .and_raise(StandardError)
      end

      it { is_expected.to be false }

      it 'logs the error' do
        expect(shared).to receive(:error).with(instance_of(StandardError))

        subject
      end
    end
  end

  describe '#group_members_tree' do
    subject { described_class.new(shared: shared).group_members_tree }

    it 'delegates to AttributesFinder#find_root' do
      expect_any_instance_of(Gitlab::ImportExport::AttributesFinder)
        .to receive(:find_root)
        .with(:group_members)

      subject
    end
  end
end