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

file_upload_spec.rb « file_acquisition_strategies « gitlab_projects « import « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c7881381574ced7f6502412416b7522abd9e35c (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::Import::GitlabProjects::FileAcquisitionStrategies::FileUpload, :aggregate_failures do
  let(:file) { UploadedFile.new(File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz')) }

  describe 'validation' do
    it 'validates presence of file' do
      valid = described_class.new(params: { file: file })
      expect(valid).to be_valid

      invalid = described_class.new(params: {})
      expect(invalid).not_to be_valid
      expect(invalid.errors.full_messages).to include("File must be uploaded")
    end
  end

  describe '#project_params' do
    it 'returns the file to upload in the params' do
      subject = described_class.new(params: { file: file })

      expect(subject.project_params).to eq(file: file)
    end
  end
end