Commit 40b9eea4 authored by Sean McGivern's avatar Sean McGivern

Fix flaky DAST profile schedule audit spec

In some conditions - the most trivial of which are when this spec is run
in isolation with a clean test database - the profile schedule and
profile created by this spec could have the same ID, in different
tables. The spec would then find the wrong audit event in the audit
events table, because it was looking up only by `target_id`, and fail as
a result.
parent fc3ced13
......@@ -104,7 +104,7 @@ RSpec.describe AppSec::Dast::Profiles::CreateService do
it 'audits the creation' do
schedule = subject.payload[:dast_profile_schedule]
audit_event = AuditEvent.find_by(target_id: schedule.id)
audit_event = AuditEvent.find_by(target_id: schedule.id, target_type: schedule.class)
aggregate_failures do
expect(audit_event.author).to eq(developer)
......
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