Add and apply FactoryBot/RedundantFactoryOption rule

This rule was added in rubocop-factory_bot 2.23.0.
This commit is contained in:
Javi Martín
2023-09-08 13:39:24 +02:00
parent 3b2484af77
commit b88a01f641
7 changed files with 10 additions and 7 deletions

View File

@@ -41,6 +41,9 @@ FactoryBot/FactoryAssociationWithStrategy:
FactoryBot/FactoryClassName: FactoryBot/FactoryClassName:
Enabled: true Enabled: true
FactoryBot/RedundantFactoryOption:
Enabled: true
Layout/ArgumentAlignment: Layout/ArgumentAlignment:
Enabled: true Enabled: true

View File

@@ -41,7 +41,7 @@ FactoryBot.define do
factory :banner_section, class: "Banner::Section" do factory :banner_section, class: "Banner::Section" do
association :banner_id, factory: :banner association :banner_id, factory: :banner
association :web_section, factory: :web_section association :web_section
end end
factory :site_customization_page, class: "SiteCustomization::Page" do factory :site_customization_page, class: "SiteCustomization::Page" do

View File

@@ -251,7 +251,7 @@ FactoryBot.define do
end end
factory :budget_ballot, class: "Budget::Ballot" do factory :budget_ballot, class: "Budget::Ballot" do
association :user, factory: :user association :user
budget budget
transient { investments { [] } } transient { investments { [] } }

View File

@@ -47,6 +47,6 @@ FactoryBot.define do
factory :flag do factory :flag do
association :flaggable, factory: :debate association :flaggable, factory: :debate
association :user, factory: :user association :user
end end
end end

View File

@@ -2,7 +2,7 @@ FactoryBot.define do
factory :image do factory :image do
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/clippy.jpg") } attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/clippy.jpg") }
title { "Lorem ipsum dolor sit amet" } title { "Lorem ipsum dolor sit amet" }
association :user, factory: :user association :user
trait :proposal_image do trait :proposal_image do
association :imageable, factory: :proposal association :imageable, factory: :proposal
@@ -19,7 +19,7 @@ FactoryBot.define do
factory :document do factory :document do
sequence(:title) { |n| "Document title #{n}" } sequence(:title) { |n| "Document title #{n}" }
association :user, factory: :user association :user
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/empty.pdf") } attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/empty.pdf") }
trait :proposal_document do trait :proposal_document do

View File

@@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :machine_learning_job do factory :machine_learning_job do
association :user, factory: :user association :user
script { "script.py" } script { "script.py" }
started_at { Time.current } started_at { Time.current }
finished_at { nil } finished_at { nil }

View File

@@ -126,7 +126,7 @@ FactoryBot.define do
end end
factory :follow do factory :follow do
association :user, factory: :user association :user
trait :followed_proposal do trait :followed_proposal do
association :followable, factory: :proposal association :followable, factory: :proposal