summaryrefslogtreecommitdiff
path: root/spec/models/bulk_imports/file_transfer_spec.rb
blob: 5a2b303626c466891ab7d5087367f6a1aa36e7e1 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::FileTransfer do
  describe '.config_for' do
    context 'when portable is group' do
      it 'returns group config' do
        expect(described_class.config_for(build(:group))).to be_instance_of(BulkImports::FileTransfer::GroupConfig)
      end
    end

    context 'when portable is project' do
      it 'returns project config' do
        expect(described_class.config_for(build(:project))).to be_instance_of(BulkImports::FileTransfer::ProjectConfig)
      end
    end

    context 'when portable is unsupported' do
      it 'raises an error' do
        expect { described_class.config_for(nil) }.to raise_error(BulkImports::FileTransfer::UnsupportedObjectType)
      end
    end
  end
end