Skip to content

Commit

Permalink
[ART] lint and spec fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nihil2501 authored and ojbucao committed Jan 10, 2025
1 parent 7299953 commit dcd8cd6
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ class PowerOfAttorneyRequestResolution < ApplicationRecord
].freeze

delegated_type :resolving,
types: RESOLVING_TYPES,
inverse_of: :resolution
types: RESOLVING_TYPES,
inverse_of: :resolution

module Resolving
extend ActiveSupport::Concern

included do
has_one :resolution,
as: :resolving,
inverse_of: :resolving,
class_name: 'PowerOfAttorneyRequestResolution',
required: true
as: :resolving,
inverse_of: :resolving,
class_name: 'PowerOfAttorneyRequestResolution',
required: true
end
end

Expand Down
40 changes: 21 additions & 19 deletions modules/accredited_representative_portal/lib/tasks/seed.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace :accredited_representative_portal do
end
end

# rubocop:disable Metrics/MethodLength, Metrics/ModuleLength, Rails/SkipsModelValidations
module AccreditedRepresentativePortal
##
# Representative records derived from here:
Expand All @@ -31,17 +32,17 @@ module AccreditedRepresentativePortal
ActiveRecord::Base.transaction do
insert_all(
Records::ATTORNEYS,
factory: [
:accredited_individual,
:attorney
factory: %i[
accredited_individual
attorney
]
)

insert_all(
Records::CLAIMS_AGENTS,
factory: [
:accredited_individual,
:claims_agent
factory: %i[
accredited_individual
claims_agent
]
)

Expand All @@ -56,9 +57,9 @@ module AccreditedRepresentativePortal

insert_all(
Records::REPRESENTATIVES,
factory: [
:accredited_individual,
:representative
factory: %i[
accredited_individual
representative
]
) do |representative|
representative
Expand All @@ -76,9 +77,9 @@ module AccreditedRepresentativePortal
factory: [
:accreditation
],
unique_by: [
:accredited_organization_id,
:accredited_individual_id
unique_by: %i[
accredited_organization_id
accredited_individual_id
]
)

Expand Down Expand Up @@ -186,7 +187,7 @@ module AccreditedRepresentativePortal

def insert_all(records, factory:, unique_by: nil)
records =
records.map.with_index do |record, i|
records.map.with_index do |record, _i|
yield(record) if block_given?

FactoryBot
Expand All @@ -206,9 +207,9 @@ module AccreditedRepresentativePortal
end

RESOLUTION_HISTORY_CYCLE =
[:expiration, :declination, :acceptance]
.permutation
.cycle
%i[expiration declination acceptance]
.permutation
.cycle

RESOLVED_TIME_TRAVELER =
Enumerator.new do |yielder|
Expand All @@ -219,9 +220,9 @@ module AccreditedRepresentativePortal
# These 3 entries spread are here because we are making 3 POA
# requests per claimant in a row.
#
yielder << time + 0.days
yielder << time + 10.days
yielder << time + 20.days
yielder << (time + 0.days)
yielder << (time + 10.days)
yielder << (time + 20.days)
time += 6.hours
end
end
Expand All @@ -238,3 +239,4 @@ module AccreditedRepresentativePortal
end
end
end
# rubocop:enable Metrics/MethodLength, Metrics/ModuleLength, Rails/SkipsModelValidations
98 changes: 50 additions & 48 deletions modules/accredited_representative_portal/lib/tasks/seed/records.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Metrics/ModuleLength
module AccreditedRepresentativePortal
module Seed
module Records
Expand Down Expand Up @@ -113,55 +114,55 @@ module Records
last_name: 'Representative',
id: 'd9d7e941-7156-4eca-827c-bcabe731d7ea',
registration_number: '10000',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'41d36596-67d1-4b23-ab58-927447e88d07'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
41d36596-67d1-4b23-ab58-927447e88d07
]
},
{
first_name: 'Robert',
last_name: 'Lowe',
id: '3f47a6c7-ce14-4ab5-9567-6e3803336fe1',
registration_number: '10001',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
]
},
{
first_name: 'Suzie',
last_name: 'Lowe',
id: '90e83d10-8ce1-482b-8f06-45bea0cc7f3c',
registration_number: '10002',
organization_ids: [
'41d36596-67d1-4b23-ab58-927447e88d07',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
41d36596-67d1-4b23-ab58-927447e88d07
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Jewell',
last_name: 'Armstrong',
id: 'a1e66cea-bd2d-4997-8b08-42770fc0ebce',
registration_number: '10003',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'41d36596-67d1-4b23-ab58-927447e88d07',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
41d36596-67d1-4b23-ab58-927447e88d07
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Odis',
last_name: 'Cruickshank',
id: '96dc6994-1949-4f83-a6ad-a3bd9fd728e0',
registration_number: '10004',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
83b7de4d-a2cd-4b15-9e32-af48804c3e31
]
},
{
Expand All @@ -178,69 +179,69 @@ module Records
last_name: 'Representative',
id: 'c50410bb-7341-4d95-9a2f-aed22178ff08',
registration_number: '10006',
organization_ids: [
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Erin',
last_name: 'Trust',
id: '595e4651-4bd0-4094-8007-f3711001efe5',
registration_number: '10007',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Eric',
last_name: 'Good',
id: 'c3063f49-f751-4b94-9d18-4a98f08c2926',
registration_number: '10008',
organization_ids: [
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68'
organization_ids: %w[
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
]
},
{
first_name: 'Hershel',
last_name: 'Kertzmann',
id: '9e68bca2-10e1-48cc-be75-b1ce64d07ef4',
registration_number: '10009',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'41d36596-67d1-4b23-ab58-927447e88d07',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
41d36596-67d1-4b23-ab58-927447e88d07
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Georgetta',
last_name: 'Roob',
id: 'c6999376-28ca-45b9-a840-40c6c7c4edef',
registration_number: '10010',
organization_ids: [
'23563963-e31c-4797-a259-e26b727072e1',
'41d36596-67d1-4b23-ab58-927447e88d07',
'83b7de4d-a2cd-4b15-9e32-af48804c3e31',
'31f61e0f-8993-4c57-86f2-7f22e9ca9e68',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
23563963-e31c-4797-a259-e26b727072e1
41d36596-67d1-4b23-ab58-927447e88d07
83b7de4d-a2cd-4b15-9e32-af48804c3e31
31f61e0f-8993-4c57-86f2-7f22e9ca9e68
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
{
first_name: 'Horacio',
last_name: 'Schultz',
id: '0ea9df23-a0b9-42bc-9629-b6ad66704825',
registration_number: '10011',
organization_ids: [
'41d36596-67d1-4b23-ab58-927447e88d07',
'4e21e4b2-02e5-4a96-ace3-8b56b97a275c'
organization_ids: %w[
41d36596-67d1-4b23-ab58-927447e88d07
4e21e4b2-02e5-4a96-ace3-8b56b97a275c
]
},
}
].freeze

CLAIMANTS = [
Expand Down Expand Up @@ -412,3 +413,4 @@ module Records
end
end
end
# rubocop:enable Metrics/ModuleLength
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
{
authorizations: {
record_disclosure: Faker::Boolean.boolean,
record_disclosure_limitations: [
"ALCOHOLISM",
"DRUG_ABUSE",
"HIV",
"SICKLE_CELL"
record_disclosure_limitations: %w[
ALCOHOLISM
DRUG_ABUSE
HIV
SICKLE_CELL
].select { rand < 0.5 },
address_change: Faker::Boolean.boolean
},
Expand All @@ -80,23 +80,23 @@
address_line2: nil,
city: Faker::Address.city,
state_code: Faker::Address.state_abbr,
country: "US",
country: 'US',
zip_code: Faker::Address.zip_code,
zip_code_suffix: nil
},
ssn: Faker::Number.number(digits: 9).to_s,
va_file_number: Faker::Number.number(digits: 9).to_s,
date_of_birth: Faker::Date.birthday(min_age: 21, max_age: 100).to_s,
service_number: Faker::Number.number(digits: 9).to_s,
service_branch: [
"ARMY",
"NAVY",
"AIR_FORCE",
"MARINE_CORPS",
"COAST_GUARD",
"SPACE_FORCE",
"NOAA",
"USPHS"
service_branch: %w[
ARMY
NAVY
AIR_FORCE
MARINE_CORPS
COAST_GUARD
SPACE_FORCE
NOAA
USPHS
].sample,
phone: Faker::PhoneNumber.phone_number,
email: Faker::Internet.email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
expect(decision).not_to be_valid
expect(decision.errors.full_messages).to eq(
[
'Type is not included in the list',
'Resolution is invalid'
'Type is not included in the list'
]
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
expect(resolution_b).not_to be_valid
expect(resolution_b.errors.full_messages).to eq(
[
'Power of attorney request has already been taken',
'Resolving is invalid'
'Power of attorney request has already been taken'
]
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
expect(poa_request).not_to be_valid
expect(poa_request.errors.full_messages).to eq(
[
'Power of attorney form is invalid',
'Claimant type is not included in the list'
]
)
Expand Down

0 comments on commit dcd8cd6

Please sign in to comment.