Commit f422a13f authored by Stan Hu's avatar Stan Hu

Merge branch 'pl-rubocop-inline-association-resources' into 'master'

Fix cop FactoryBot/InlineAssociation for resource events

See merge request gitlab-org/gitlab!45684
parents f3718dc5 9847a0a9
......@@ -1323,9 +1323,6 @@ FactoryBot/InlineAssociation:
- 'spec/factories/notes.rb'
- 'spec/factories/packages.rb'
- 'spec/factories/packages/package_file.rb'
- 'spec/factories/resource_label_events.rb'
- 'spec/factories/resource_milestone_event.rb'
- 'spec/factories/resource_state_event.rb'
- 'spec/factories/sent_notifications.rb'
- 'spec/factories/serverless/domain.rb'
- 'spec/factories/serverless/domain_cluster.rb'
......
......@@ -4,7 +4,7 @@ FactoryBot.define do
factory :resource_label_event do
action { :add }
label
user { issuable&.author || create(:user) }
user { issuable&.author || association(:user) }
after(:build) do |event, evaluator|
event.issue = create(:issue) unless event.issuable
......
......@@ -2,11 +2,11 @@
FactoryBot.define do
factory :resource_milestone_event do
issue { merge_request.nil? ? create(:issue) : nil }
issue { merge_request.nil? ? association(:issue) : nil }
merge_request { nil }
milestone
action { :add }
state { :opened }
user { issue&.author || merge_request&.author || create(:user) }
user { issue&.author || merge_request&.author || association(:user) }
end
end
......@@ -2,9 +2,9 @@
FactoryBot.define do
factory :resource_state_event do
issue { merge_request.nil? ? create(:issue) : nil }
issue { merge_request.nil? ? association(:issue) : nil }
merge_request { nil }
state { :opened }
user { issue&.author || merge_request&.author || create(:user) }
user { issue&.author || merge_request&.author || association(:user) }
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