Add and apply FactoryBot/FactoryClassName rule

This rule is available since rubocop-rspec 1.37.0. We were already
applying the same principle in the models since commit 234a5108.
This commit is contained in:
Javi Martín
2020-09-27 20:48:07 +02:00
parent b6a095ced7
commit 40244d6411
4 changed files with 9 additions and 6 deletions

View File

@@ -29,6 +29,9 @@ Capybara/FeatureMethods:
FactoryBot/AttributeDefinedStatically:
Enabled: true
FactoryBot/FactoryClassName:
Enabled: true
Layout/AssignmentIndentation:
Enabled: true

View File

@@ -1,5 +1,5 @@
FactoryBot.define do
factory :ahoy_event, class: Ahoy::Event do
factory :ahoy_event, class: "Ahoy::Event" do
id { SecureRandom.uuid }
time { DateTime.current }
sequence(:name) { |n| "Event #{n} type" }

View File

@@ -263,7 +263,7 @@ FactoryBot.define do
reason { "unfeasible" }
end
factory :valuator_group, class: ValuatorGroup do
factory :valuator_group, class: "ValuatorGroup" do
sequence(:name) { |n| "Valuator Group #{n}" }
end

View File

@@ -14,7 +14,7 @@ FactoryBot.define do
sequence(:document_number) { |n| "#{n.to_s.rjust(8, "0")}X" }
factory :verification_residence, class: Verification::Residence do
factory :verification_residence, class: "Verification::Residence" do
user
document_number
document_type { "1" }
@@ -35,11 +35,11 @@ FactoryBot.define do
postal_code { "28000" }
end
factory :verification_sms, class: Verification::Sms do
factory :verification_sms, class: "Verification::Sms" do
phone { "699999999" }
end
factory :verification_letter, class: Verification::Letter do
factory :verification_letter, class: "Verification::Letter" do
user
email { "user@consul.dev" }
password { "1234" }
@@ -57,7 +57,7 @@ FactoryBot.define do
document_type { "dni" }
end
factory :verification_document, class: Verification::Management::Document do
factory :verification_document, class: "Verification::Management::Document" do
document_number
document_type { "1" }
date_of_birth { Date.new(1980, 12, 31) }