summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/reports/security/flag_spec.rb
blob: d677425a8da71f872f41b9d03c24d5ddf0027cd2 (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

require 'spec_helper'

RSpec.describe Gitlab::Ci::Reports::Security::Flag do
  subject(:security_flag) { described_class.new(type: 'flagged-as-likely-false-positive', origin: 'post analyzer X', description: 'static string to sink') }

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

        expect(subject).to have_attributes(
          type: 'flagged-as-likely-false-positive',
          origin: 'post analyzer X',
          description: 'static string to sink'
        )
      end
    end

    describe '#to_h' do
      it 'returns expected hash' do
        expect(security_flag.to_h).to eq(
          {
            flag_type: :false_positive,
            origin: 'post analyzer X',
            description: 'static string to sink'
          }
        )
      end
    end
  end
end