# 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
