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

scan_spec.rb « security « reports « ci « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 23427e8608ce7915b357f2c60357d3ea6129440a (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
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::Ci::Reports::Security::Scan do
  describe '#initialize' do
    subject { described_class.new(params.with_indifferent_access) }

    let(:params) do
      {
        status: 'success',
        type: 'dependency-scanning',
        start_time: 'placeholer',
        end_time: 'placholder'
      }
    end

    context 'when all params are given' do
      it 'initializes an instance' do
        expect { subject }.not_to raise_error

        expect(subject).to have_attributes(
          status: 'success',
          type: 'dependency-scanning',
          start_time: 'placeholer',
          end_time: 'placholder'
        )
      end
    end

    describe '#to_hash' do
      subject { described_class.new(params.with_indifferent_access).to_hash }

      it 'returns expected hash' do
        is_expected.to eq(
          {
            status: 'success',
            type: 'dependency-scanning',
            start_time: 'placeholer',
            end_time: 'placholder'
          }
        )
      end
    end
  end
end