Commit d0951b23 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Extend Security::Report interface with project methods

parent 28c67a8a
...@@ -5,16 +5,11 @@ module Gitlab ...@@ -5,16 +5,11 @@ module Gitlab
module Reports module Reports
module Security module Security
class Report class Report
attr_reader :created_at attr_reader :created_at, :type, :pipeline, :findings, :scanners, :identifiers
attr_reader :type attr_accessor :scan, :scanned_resources, :error
attr_reader :pipeline
attr_reader :findings
attr_reader :scanners
attr_reader :identifiers
attr_accessor :scan delegate :project, to: :pipeline
attr_accessor :scanned_resources delegate :id, to: :project, prefix: true
attr_accessor :error
def initialize(type, pipeline, created_at) def initialize(type, pipeline, created_at)
@type = type @type = type
......
...@@ -5,10 +5,13 @@ require 'spec_helper' ...@@ -5,10 +5,13 @@ require 'spec_helper'
RSpec.describe Gitlab::Ci::Reports::Security::Report do RSpec.describe Gitlab::Ci::Reports::Security::Report do
let_it_be(:pipeline) { create(:ci_pipeline) } let_it_be(:pipeline) { create(:ci_pipeline) }
let(:report) { described_class.new('sast', pipeline, created_at) }
let(:created_at) { 2.weeks.ago } let(:created_at) { 2.weeks.ago }
subject(:report) { described_class.new('sast', pipeline, created_at) }
it { expect(report.type).to eq('sast') } it { expect(report.type).to eq('sast') }
it { is_expected.to delegate_method(:project).to(:pipeline) }
it { is_expected.to delegate_method(:id).to(:project).with_prefix }
describe '#add_scanner' do describe '#add_scanner' do
let(:scanner) { create(:ci_reports_security_scanner, external_id: 'find_sec_bugs') } let(:scanner) { create(:ci_reports_security_scanner, external_id: 'find_sec_bugs') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment