diff --git a/ee/spec/services/vulnerabilities/starboard_vulnerability_resolve_service_spec.rb b/ee/spec/services/vulnerabilities/starboard_vulnerability_resolve_service_spec.rb index ac7aa7ad004983bd9b0821a13de3571671358291..d69d1df8888d89ccb0dc1bc4bfd40196bd7781c5 100644 --- a/ee/spec/services/vulnerabilities/starboard_vulnerability_resolve_service_spec.rb +++ b/ee/spec/services/vulnerabilities/starboard_vulnerability_resolve_service_spec.rb @@ -19,7 +19,7 @@ let_it_be(:undetected_vulnerabilities) { existing_vulnerabilities - detected_vulnerabilities } let_it_be(:uuids) { detected_vulnerabilities.map(&:finding).map(&:uuid) } - subject(:service) { described_class.new(agent, uuids) } + let(:service) { described_class.new(agent, uuids) } describe "#new" do specify { expect(service.author).to be(user) } @@ -28,8 +28,6 @@ end describe "#execute" do - subject { service.execute } - context 'with authorized user' do before_all do project.add_developer(user) @@ -41,13 +39,13 @@ end it 'resolves vulnerabilities' do - subject + service.execute expect(Vulnerability.resolved).to match_array(undetected_vulnerabilities) end it 'marks vulnerabilities as resolved on default branch' do - subject + service.execute expect(Vulnerability.with_resolution).to match_array(undetected_vulnerabilities) end @@ -55,13 +53,13 @@ it 'does not resolve vulnerabilities with other report types' do Vulnerability.where(id: undetected_vulnerabilities).update_all(report_type: :container_scanning) - expect { subject }.not_to change { Vulnerability.resolved.count } + expect { service.execute }.not_to change { Vulnerability.resolved.count } end it "does not resolve other projects' vulnerabilities" do Vulnerability.where(id: undetected_vulnerabilities).update_all(project_id: create(:project).id) - expect { subject }.not_to change { Vulnerability.resolved.count } + expect { service.execute }.not_to change { Vulnerability.resolved.count } end it "does not resolve vulnerabilities created by other agent" do @@ -70,14 +68,14 @@ finding.save! end - expect { subject }.not_to change { Vulnerability.resolved.count } + expect { service.execute }.not_to change { Vulnerability.resolved.count } end it 'does not resolve vulnerabilities in passive states' do EE::Vulnerability::PASSIVE_STATES.each do |state| Vulnerability.where(id: undetected_vulnerabilities).update_all(state: state) - expect { subject }.not_to change { Vulnerability.resolved.count } + expect { service.execute }.not_to change { Vulnerability.resolved.count } end end end @@ -88,7 +86,7 @@ end it 'raises AccessDeniedError' do - expect { subject }.to raise_error(Gitlab::Access::AccessDeniedError) + expect { service.execute }.to raise_error(Gitlab::Access::AccessDeniedError) end end end @@ -99,7 +97,7 @@ end it 'raises AccessDeniedError' do - expect { subject }.to raise_error(Gitlab::Access::AccessDeniedError) + expect { service.execute }.to raise_error(Gitlab::Access::AccessDeniedError) end end end