Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

require 'claims_api/v2/disability_compensation_shared_service_module'
require 'claims_api/lighthouse_military_address_validator'
require 'claims_api/disability_compensation_validations_helper'

module ClaimsApi
module V2
module DisabilityCompensationValidation # rubocop:disable Metrics/ModuleLength
include DisabilityCompensationSharedServiceModule
include DisabilityCompensationValidationsHelper
Comment thread
siddharthalamsal marked this conversation as resolved.
Outdated
include LighthouseMilitaryAddressValidator

DATE_FORMATS = {
Expand Down Expand Up @@ -51,14 +53,6 @@ def validate_form_526_submission_values(target_veteran)

private

def claim_date
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a repeat of the helper file claim_date method

@claim_date = if date_is_valid?(form_attributes['claimDate'], 'claimDate', true)
Date.parse(form_attributes['claimDate'])
else
Time.zone.today
end
end

def validate_form_526_change_of_address
return if form_attributes['changeOfAddress'].blank?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def validate_field(field_path, expected_detail, expected_source)
# Ensure claimDate is not set
expect(subject.form_attributes).not_to have_key('claimDate')

expect(subject.send(:claim_date)).to eq(Time.zone.today)
expect(subject.send(:claim_date)).to eq(Date.current)

errors = test_526_validation_instance.send(:error_collection)

Expand All @@ -591,7 +591,7 @@ def validate_field(field_path, expected_detail, expected_source)
subject.form_attributes['claimDate'] = 'invalid-date'
subject.instance_variable_set(:@claim_date, nil)

expect(subject.send(:claim_date)).to eq(Time.zone.today)
expect(subject.send(:claim_date)).to eq(Date.current)
errors = test_526_validation_instance.send(:error_collection)

expect(errors).to be_empty
Expand Down
Loading