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

pages_deployments.rb « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 56aab4fa9f366be4a069d06421bfc6c0cab5105e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

FactoryBot.define do
  factory :pages_deployment, class: 'PagesDeployment' do
    project

    after(:build) do |deployment, _evaluator|
      filepath = Rails.root.join("spec/fixtures/pages.zip")

      deployment.file = fixture_file_upload(filepath)
      deployment.file_sha256 = Digest::SHA256.file(filepath).hexdigest
      ::Zip::File.open(filepath) do |zip_archive|
        deployment.file_count = zip_archive.count
      end
    end
  end
end