add project import spec
This commit is contained in:
parent
de67c59720
commit
9bfa690b7d
1 changed files with 25 additions and 0 deletions
25
spec/requests/api/project_import_spec.rb
Normal file
25
spec/requests/api/project_import_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe API::ProjectImport do
|
||||
let(:export_path) { "#{Dir.tmpdir}/project_export_spec" }
|
||||
let(:user) { create(:user) }
|
||||
let(:file) { File.join(Rails.root, 'spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
|
||||
let(:namespace){ create(:group) }
|
||||
before do
|
||||
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
|
||||
|
||||
group.add_owner(user)
|
||||
end
|
||||
|
||||
after do
|
||||
FileUtils.rm_rf(export_path, secure: true)
|
||||
end
|
||||
|
||||
it 'schedules an import' do
|
||||
expect_any_instance_of(Project).to receive(:import_schedule)
|
||||
|
||||
post "/projects/import", file: file, namespace: namespace.full_path
|
||||
|
||||
expect(project.status).to eq('started')
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue