debian-mirror-gitlab/spec/lib/gitlab/github_import/importer/lfs_object_importer_spec.rb

32 lines
956 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::GithubImport::Importer::LfsObjectImporter do
2018-11-08 19:23:39 +05:30
let(:project) { create(:project) }
2019-02-02 18:00:53 +05:30
let(:lfs_attributes) do
{
oid: 'oid',
size: 1,
link: 'http://www.gitlab.com/lfs_objects/oid'
}
2018-11-08 19:23:39 +05:30
end
2021-01-29 00:20:46 +05:30
let(:lfs_download_object) { LfsDownloadObject.new(**lfs_attributes) }
2019-02-02 18:00:53 +05:30
let(:github_lfs_object) { Gitlab::GithubImport::Representation::LfsObject.new(lfs_attributes) }
2018-11-08 19:23:39 +05:30
let(:importer) { described_class.new(github_lfs_object, project, nil) }
describe '#execute' do
it 'calls the LfsDownloadService with the lfs object attributes' do
2019-02-02 18:00:53 +05:30
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)
2018-11-08 19:23:39 +05:30
importer.execute
end
end
end