Commit a0f63899 authored by Markus Koller's avatar Markus Koller

Merge branch 'parent-strategy-fix-event-spec' into 'master'

Use parent strategy for associations in factories - Event spec

See merge request gitlab-org/gitlab!41374
parents 432a96d2 477896c4
...@@ -722,7 +722,14 @@ RSpec.describe Event do ...@@ -722,7 +722,14 @@ RSpec.describe Event do
note_on_commit: true note_on_commit: true
} }
valid_target_factories.map do |kind, needs_project| valid_target_factories.map do |kind, needs_project|
extra_data = needs_project ? { project: project } : {} extra_data = if kind == :merge_request
{ source_project: project }
elsif needs_project
{ project: project }
else
{}
end
target = kind == :project ? nil : build(kind, **extra_data) target = kind == :project ? nil : build(kind, **extra_data)
[kind, build(:event, :created, project: project, target: target)] [kind, build(:event, :created, project: project, target: target)]
end.to_h end.to_h
......
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