summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/github_import/importer/lfs_object_importer_spec.rb
blob: add554992f16bc06003216b680486389af8b77eb (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::GithubImport::Importer::LfsObjectImporter do
  let(:project) { create(:project) }
  let(:lfs_attributes) do
    {
      oid: 'oid',
      size: 1,
      link: 'http://www.gitlab.com/lfs_objects/oid'
    }
  end

  let(:lfs_download_object) { LfsDownloadObject.new(lfs_attributes) }
  let(:github_lfs_object) { Gitlab::GithubImport::Representation::LfsObject.new(lfs_attributes) }

  let(:importer) { described_class.new(github_lfs_object, project, nil) }

  describe '#execute' do
    it 'calls the LfsDownloadService with the lfs object attributes' do
      allow(importer).to receive(:lfs_download_object).and_return(lfs_download_object)

      service = double
      expect(Projects::LfsPointers::LfsDownloadService).to receive(:new).with(project, lfs_download_object).and_return(service)
      expect(service).to receive(:execute)

      importer.execute
    end
  end
end