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

package_files_controller_spec.rb « packages « projects « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a6daf57f0fac668155f2687d5f3d9c07e00dcb44 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Projects::Packages::PackageFilesController do
  let_it_be(:project) { create(:project, :public) }
  let_it_be(:package) { create(:package, project: project) }
  let_it_be(:package_file) { create(:package_file, package: package) }

  let(:filename) { package_file.file_name }

  describe 'GET download' do
    subject do
      get download_namespace_project_package_file_url(
        id: package_file.id,
        namespace_id: project.namespace,
        project_id: project
      )
    end

    it 'sends the package file' do
      subject

      expect(response.headers['Content-Disposition'])
        .to eq(%Q(attachment; filename="#{filename}"; filename*=UTF-8''#{filename}))
    end

    it_behaves_like 'bumping the package last downloaded at field'
  end
end