From 40244d6411e037d9b86155a20a1630031c09d20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 27 Sep 2020 20:48:07 +0200 Subject: [PATCH] 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. --- .rubocop.yml | 3 +++ spec/factories/analytics.rb | 2 +- spec/factories/budgets.rb | 2 +- spec/factories/verifications.rb | 8 ++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f4dfe5482..1e4ff93cb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -29,6 +29,9 @@ Capybara/FeatureMethods: FactoryBot/AttributeDefinedStatically: Enabled: true +FactoryBot/FactoryClassName: + Enabled: true + Layout/AssignmentIndentation: Enabled: true diff --git a/spec/factories/analytics.rb b/spec/factories/analytics.rb index 17b1db3b4..360eeeaad 100644 --- a/spec/factories/analytics.rb +++ b/spec/factories/analytics.rb @@ -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" } diff --git a/spec/factories/budgets.rb b/spec/factories/budgets.rb index 0d3b9f18e..871309dfe 100644 --- a/spec/factories/budgets.rb +++ b/spec/factories/budgets.rb @@ -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 diff --git a/spec/factories/verifications.rb b/spec/factories/verifications.rb index 758747ff2..1fea6096a 100644 --- a/spec/factories/verifications.rb +++ b/spec/factories/verifications.rb @@ -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) }