debian-mirror-gitlab/spec/lib/gitlab/import_export/import_export_spec.rb

33 lines
1,012 B
Ruby
Raw Normal View History

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
2017-08-17 22:00:37 +05:30
let(:group) { create(:group, :nested) }
2017-09-10 17:25:29 +05:30
let(:project) { create(: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