2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::ImportExport do
|
2016-08-24 12:49:21 +05:30
|
|
|
describe 'export filename' do
|
2021-04-17 20:07:23 +05:30
|
|
|
let(:group) { build(:group, path: 'child', parent: build(:group, path: 'parent')) }
|
|
|
|
let(:project) { build(:project, :public, path: 'project-path', namespace: group) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
it 'contains the project path' do
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(described_class.export_filename(exportable: project)).to include(project.path)
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains the namespace path' do
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(described_class.export_filename(exportable: project)).to include(project.namespace.full_path.tr('/', '_'))
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not go over a certain length' do
|
|
|
|
project.path = 'a' * 100
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
expect(described_class.export_filename(exportable: project).length).to be < 70
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
2020-04-08 14:13:33 +05:30
|
|
|
|
|
|
|
describe '#snippet_repo_bundle_filename_for' do
|
|
|
|
let(:snippet) { build(:snippet, id: 1) }
|
|
|
|
|
|
|
|
it 'generates the snippet bundle name' do
|
|
|
|
expect(described_class.snippet_repo_bundle_filename_for(snippet)).to eq "#{snippet.hexdigest}.bundle"
|
|
|
|
end
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|