2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe Gitlab::ImportExport::WikiRepoSaver do
|
2016-06-22 15:30:34 +05:30
|
|
|
describe 'bundle a wiki Git repo' do
|
2019-12-21 20:55:43 +05:30
|
|
|
set(:user) { create(:user) }
|
|
|
|
let!(:project) { create(:project, :wiki_repo) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
|
2018-03-27 19:54:05 +05:30
|
|
|
let(:shared) { project.import_export_shared }
|
2016-06-22 15:30:34 +05:30
|
|
|
let(:wiki_bundler) { described_class.new(project: project, shared: shared) }
|
|
|
|
let!(:project_wiki) { ProjectWiki.new(project, user) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2020-01-01 13:55:28 +05:30
|
|
|
allow_next_instance_of(Gitlab::ImportExport) do |instance|
|
|
|
|
allow(instance).to receive(:storage_path).and_return(export_path)
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
project_wiki.wiki
|
|
|
|
project_wiki.create_page("index", "test content")
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
FileUtils.rm_rf(export_path)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'bundles the repo successfully' do
|
|
|
|
expect(wiki_bundler.save).to be true
|
|
|
|
end
|
2019-12-21 20:55:43 +05:30
|
|
|
|
|
|
|
context 'when the repo is empty' do
|
|
|
|
let!(:project) { create(:project) }
|
|
|
|
|
|
|
|
it 'bundles the repo successfully' do
|
|
|
|
expect(wiki_bundler.save).to be true
|
|
|
|
end
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
|
|
|
end
|