From a958355b55876bc56f9b6db5a82ce7176386d50e Mon Sep 17 00:00:00 2001 From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:30:22 -0600 Subject: [PATCH] Linting & cleans up 526 factory --- .../app/sidekiq/claims_api/reporting_base.rb | 4 +-- .../spec/factories/auto_established_claims.rb | 30 +++---------------- .../sidekiq/shared_reporting_examples_spec.rb | 4 +-- ..._api_unsuccessful_report_mailer_preview.rb | 22 +++++++------- 4 files changed, 18 insertions(+), 42 deletions(-) diff --git a/modules/claims_api/app/sidekiq/claims_api/reporting_base.rb b/modules/claims_api/app/sidekiq/claims_api/reporting_base.rb index 16871730a4..5217d53c82 100644 --- a/modules/claims_api/app/sidekiq/claims_api/reporting_base.rb +++ b/modules/claims_api/app/sidekiq/claims_api/reporting_base.rb @@ -168,8 +168,8 @@ def make_claims FactoryBot.create(:auto_established_claim_va_gov, created_at: Time.zone.now) FactoryBot.create(:auto_established_claim_va_gov, created_at: Time.zone.now) - FactoryBot.create(:auto_established_claim_va_gov, :set_transaction_id, created_at: Time.zone.now) - FactoryBot.create(:auto_established_claim_va_gov, :set_transaction_id, created_at: Time.zone.now) + FactoryBot.create(:auto_established_claim_va_gov, :transaction_id_25, created_at: Time.zone.now) + FactoryBot.create(:auto_established_claim_va_gov, :transaction_id_25, created_at: Time.zone.now) FactoryBot.create(:auto_established_claim_v2, status: 'errored') FactoryBot.create(:auto_established_claim_v2, status: 'pending') diff --git a/modules/claims_api/spec/factories/auto_established_claims.rb b/modules/claims_api/spec/factories/auto_established_claims.rb index 337faad200..ba04716288 100644 --- a/modules/claims_api/spec/factories/auto_established_claims.rb +++ b/modules/claims_api/spec/factories/auto_established_claims.rb @@ -77,7 +77,7 @@ status { ClaimsApi::AutoEstablishedClaim::ERRORED } end - trait :set_transaction_id do + trait :transaction_id_25 do transaction_id { '25' } end @@ -99,31 +99,9 @@ status { ClaimsApi::AutoEstablishedClaim::ERRORED } end - trait :set_transaction_id do - transaction_id { '25' } - end - - factory :auto_established_claim_without_flashes_or_special_issues, class: 'ClaimsApi::AutoEstablishedClaim' do - id { SecureRandom.uuid } - status { 'pending' } - source { 'oddball' } - cid { - %w[0oa9uf05lgXYk6ZXn297 0oa66qzxiq37neilh297 0oadnb0o063rsPupH297 0oadnb1x4blVaQ5iY297 - 0oadnavva9u5F6vRz297 0oagdm49ygCSJTp8X297 0oaqzbqj9wGOCJBG8297 0oao7p92peuKEvQ73297].sample - } - evss_id { nil } - auth_headers { { test: ('a'..'z').to_a.shuffle.join } } - form_data do - json = JSON.parse(File - .read(::Rails.root.join(*'/modules/claims_api/spec/fixtures/form_526_no_flashes_no_special_issues.json'.split('/')).to_s)) - json['data']['attributes'] - end - # rubocop:enable Layout/LineLength - - trait :status_errored do - status { 'errored' } - evss_response { 'something' } - end + trait :status_errored do + status { 'errored' } + evss_response { 'something' } end factory :auto_established_claim_with_auth_headers, class: 'ClaimsApi::AutoEstablishedClaim' do diff --git a/modules/claims_api/spec/sidekiq/shared_reporting_examples_spec.rb b/modules/claims_api/spec/sidekiq/shared_reporting_examples_spec.rb index 9e7ea74424..f14a872030 100644 --- a/modules/claims_api/spec/sidekiq/shared_reporting_examples_spec.rb +++ b/modules/claims_api/spec/sidekiq/shared_reporting_examples_spec.rb @@ -62,8 +62,8 @@ with_settings(Settings.claims_api, report_enabled: true) do create(:auto_established_claim_va_gov, created_at: Time.zone.now).freeze create(:auto_established_claim_va_gov, created_at: Time.zone.now).freeze - create(:auto_established_claim_va_gov, :set_transaction_id, created_at: Time.zone.now).freeze - create(:auto_established_claim_va_gov, :set_transaction_id, created_at: Time.zone.now).freeze + create(:auto_established_claim_va_gov, :transaction_id_25, created_at: Time.zone.now).freeze + create(:auto_established_claim_va_gov, :transaction_id_25, created_at: Time.zone.now).freeze job = described_class.new job.perform diff --git a/spec/mailers/previews/claims_api_unsuccessful_report_mailer_preview.rb b/spec/mailers/previews/claims_api_unsuccessful_report_mailer_preview.rb index b303a21345..17c64598ef 100644 --- a/spec/mailers/previews/claims_api_unsuccessful_report_mailer_preview.rb +++ b/spec/mailers/previews/claims_api_unsuccessful_report_mailer_preview.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require './modules/claims_api/app/sidekiq/claims_api/reporting_base' class ClaimsApiUnsuccessfulReportMailerPreview < ActionMailer::Preview @@ -45,15 +46,15 @@ def unsuccessful_va_gov_claims_submissions def claims_totals [ { 'consumer 1' => { pending: 2, - errored: 1, - totals: 3, - percentage_with_flashes: '50.0%', - percentage_with_special_issues: '50.0%' } }, + errored: 1, + totals: 3, + percentage_with_flashes: '50.0%', + percentage_with_special_issues: '50.0%' } }, { 'consumer 2' => { pending: 3, - errored: 3, - totals: 6, - percentage_with_flashes: '50.0%', - percentage_with_special_issues: '50.0%' } } + errored: 3, + totals: 6, + percentage_with_flashes: '50.0%', + percentage_with_special_issues: '50.0%' } } ] # reporting_base.claims_totals end @@ -67,7 +68,7 @@ def poa_totals 'consumer 2' => { totals: 8, updated: 3, errored: 2, pending: 1, uploaded: 2 } } ] - + # reporting_base.poa_totals end @@ -76,7 +77,6 @@ def unsuccessful_poa_submissions end def ews_totals - [ { 'consumer 1' => { totals: 10, updated: 5, errored: 2, pending: 1, uploaded: 2 } @@ -103,8 +103,6 @@ def itf_totals ] end - private - def reporting_base ClaimsApi::ReportingBase.new end