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

any_oversized_blob_spec.rb « file_size_check « checks « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bf24d6b63c6ea99328ed046503e475f63bbad0b2 (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::Checks::FileSizeCheck::AnyOversizedBlob, feature_category: :source_code_management do
  let_it_be(:project) { create(:project, :public, :repository) }
  let(:any_blob) do
    described_class.new(
      project: project,
      changes: [{ newrev: 'bf12d2567099e26f59692896f73ac819bae45b00' }],
      file_size_limit_megabytes: 1)
  end

  describe '#find!' do
    subject { any_blob.find! }

    # SHA of the 2-mb-file branch
    let(:newrev)    { 'bf12d2567099e26f59692896f73ac819bae45b00' }
    let(:timeout) { nil }

    before do
      # Delete branch so Repository#new_blobs can return results
      project.repository.delete_branch('2-mb-file')
    end

    it 'returns the blob exceeding the file size limit' do
      blob = subject
      expect(blob).to be_kind_of(Gitlab::Git::Blob)
      expect(blob.path).to eq('file.bin')
    end
  end
end