Commit 3e127ae6 authored by Avielle Wolfe's avatar Avielle Wolfe Committed by Bob Van Landuyt

Make Vulnerable shared specs agnostic

parent c7fef435
...@@ -3,7 +3,10 @@ require 'spec_helper' ...@@ -3,7 +3,10 @@ require 'spec_helper'
describe Group do describe Group do
let(:group) { create(:group) } let(:group) { create(:group) }
it_behaves_like Vulnerable it_behaves_like Vulnerable do
let(:vulnerable) { group }
end
it { is_expected.to include_module(EE::Group) } it { is_expected.to include_module(EE::Group) }
describe 'associations' do describe 'associations' do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
shared_examples_for Vulnerable do shared_examples_for Vulnerable do
let(:project) { create(:project, namespace: group) } let(:project) { create(:project, namespace: vulnerable) }
let(:external_project) { create(:project) } let(:external_project) { create(:project) }
let(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) } let(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) }
...@@ -23,7 +23,7 @@ shared_examples_for Vulnerable do ...@@ -23,7 +23,7 @@ shared_examples_for Vulnerable do
end end
describe '#latest_vulnerabilities' do describe '#latest_vulnerabilities' do
subject { group.latest_vulnerabilities } subject { vulnerable.latest_vulnerabilities }
it 'returns vulnerabilities for the latest successful pipelines of projects belonging to the vulnerable entity' do it 'returns vulnerabilities for the latest successful pipelines of projects belonging to the vulnerable entity' do
is_expected.to contain_exactly(new_vuln) is_expected.to contain_exactly(new_vuln)
...@@ -43,9 +43,9 @@ shared_examples_for Vulnerable do ...@@ -43,9 +43,9 @@ shared_examples_for Vulnerable do
end end
describe '#latest_vulnerabilities_with_sha' do describe '#latest_vulnerabilities_with_sha' do
subject { group.latest_vulnerabilities_with_sha } subject { vulnerable.latest_vulnerabilities_with_sha }
it 'returns vulns only for the latest successful pipelines of projects belonging to the group' do it 'returns vulns only for the latest successful pipelines of projects belonging to the vulnerable' do
is_expected.to contain_exactly(new_vuln) is_expected.to contain_exactly(new_vuln)
end end
...@@ -65,9 +65,9 @@ shared_examples_for Vulnerable do ...@@ -65,9 +65,9 @@ shared_examples_for Vulnerable do
end end
describe '#all_vulnerabilities' do describe '#all_vulnerabilities' do
subject { group.all_vulnerabilities } subject { vulnerable.all_vulnerabilities }
it 'returns vulns for all successful pipelines of projects belonging to the group' do it 'returns vulns for all successful pipelines of projects belonging to the vulnerable' do
is_expected.to contain_exactly(old_vuln, new_vuln, new_vuln) is_expected.to contain_exactly(old_vuln, new_vuln, new_vuln)
end end
......
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