Commit 8b856d04 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Add regression test for execution order problem

parent 0cd4feb5
......@@ -21,8 +21,7 @@ RSpec.describe Vulnerabilities::ConfirmService do
project.add_developer(user)
end
it_behaves_like 'calls Vulnerabilities::Statistics::UpdateService'
it_behaves_like 'calls Vulnerabilities::HistoricalStatistics::UpdateService'
it_behaves_like 'calls vulnerability statistics utility services in order'
it 'confirms a vulnerability' do
Timecop.freeze do
......
......@@ -21,8 +21,7 @@ RSpec.describe Vulnerabilities::DismissService do
project.add_developer(user)
end
it_behaves_like 'calls Vulnerabilities::Statistics::UpdateService'
it_behaves_like 'calls Vulnerabilities::HistoricalStatistics::UpdateService'
it_behaves_like 'calls vulnerability statistics utility services in order'
it 'dismisses a vulnerability and its associated findings' do
Timecop.freeze do
......
......@@ -21,8 +21,7 @@ RSpec.describe Vulnerabilities::ResolveService do
project.add_developer(user)
end
it_behaves_like 'calls Vulnerabilities::Statistics::UpdateService'
it_behaves_like 'calls Vulnerabilities::HistoricalStatistics::UpdateService'
it_behaves_like 'calls vulnerability statistics utility services in order'
it 'resolves a vulnerability' do
Timecop.freeze do
......
# frozen_string_literal: true
RSpec.shared_examples 'calls vulnerability statistics utility services in order' do
before do
allow(Vulnerabilities::Statistics::UpdateService).to receive(:update_for)
allow(Vulnerabilities::HistoricalStatistics::UpdateService).to receive(:update_for)
allow(SystemNoteService).to receive(:change_vulnerability_state)
end
it 'calls the service classes in order' do
subject
expect(Vulnerabilities::Statistics::UpdateService).to have_received(:update_for).ordered
expect(Vulnerabilities::HistoricalStatistics::UpdateService).to have_received(:update_for).ordered
expect(SystemNoteService).to have_received(:change_vulnerability_state).ordered
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