Welcome to mirror list, hosted at ThFree Co, Russian Federation.

import_export_spec.rb « import_export « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87757b07572e847af94a132350a55c813b59bf94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::ImportExport do
  describe 'export filename' do
    let(:group) { build(:group, path: 'child', parent: build(:group, path: 'parent')) }
    let(:project) { build(:project, :public, path: 'project-path', namespace: group) }

    it 'contains the project path' do
      expect(described_class.export_filename(exportable: project)).to include(project.path)
    end

    it 'contains the namespace path' do
      expect(described_class.export_filename(exportable: project)).to include(project.namespace.full_path.tr('/', '_'))
    end

    it 'does not go over a certain length' do
      project.path = 'a' * 100

      expect(described_class.export_filename(exportable: project).length).to be < 70
    end
  end

  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
end