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

test_resources_data_processor_spec.rb « tools « spec « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6a8c0fd06a4f16f0039c11a9b943a6cdf447e033 (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
33
# frozen_string_literal: true

RSpec.describe QA::Tools::TestResourceDataProcessor do
  let(:info) { 'information' }
  let(:api_path) { '/foo' }
  let(:result) { [{ info: info, api_path: api_path }] }

  describe '.collect' do
    context 'when resource is not restricted' do
      let(:resource) { instance_double(QA::Resource::Project, api_delete_path: '/foo', api_response: 'foo') }

      it 'collects resource' do
        expect(described_class.collect(resource, info)).to eq(result)
      end
    end

    context 'when resource api response is nil' do
      let(:resource) { double(QA::Resource::Project, api_delete_path: '/foo', api_response: nil) }

      it 'does not collect resource' do
        expect(described_class.collect(resource, info)).to eq(nil)
      end
    end

    context 'when resource is restricted' do
      let(:resource) { double(QA::Resource::Sandbox, api_delete_path: '/foo', api_response: 'foo') }

      it 'does not collect resource' do
        expect(described_class.collect(resource, info)).to eq(nil)
      end
    end
  end
end