Commit 9847a0a9 authored by Peter Leitzen's avatar Peter Leitzen

Fix cop FactoryBot/InlineAssociation for resource events

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