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

file_uploads_shared_examples.rb « features « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ea8c8d445012c82656ec030e418763e02a2869c1 (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
# frozen_string_literal: true

RSpec.shared_examples 'handling file uploads' do |shared_examples_name|
  context 'with object storage disabled' do
    context 'with upload_middleware_jwt_params_handler disabled' do
      before do
        stub_feature_flags(upload_middleware_jwt_params_handler: false)

        expect_next_instance_of(Gitlab::Middleware::Multipart::Handler) do |handler|
          expect(handler).to receive(:with_open_files).and_call_original
        end
      end

      it_behaves_like shared_examples_name
    end

    context 'with upload_middleware_jwt_params_handler enabled' do
      before do
        stub_feature_flags(upload_middleware_jwt_params_handler: true)

        expect_next_instance_of(Gitlab::Middleware::Multipart::HandlerForJWTParams) do |handler|
          expect(handler).to receive(:with_open_files).and_call_original
        end
      end

      it_behaves_like shared_examples_name
    end
  end
end