Skip to content

Commit

Permalink
JHoang/17497-rspec-fixes-4 (#18994)
Browse files Browse the repository at this point in the history
* appeal_spec & supplemental_claim_spec fixes

* comments

* removed binding.pry

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
  • Loading branch information
3 people authored and youfoundmanesh committed Jul 20, 2023
1 parent 2267e0d commit c83b699
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 42 deletions.
118 changes: 77 additions & 41 deletions spec/feature/intake/appeal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@
participant_id: "44444444")
end

let(:veteran_file_number2) { "123412345" }
let(:veteran_with_ratings) do
Generators::Veteran.build(file_number: veteran_file_number2, first_name: "Ed", last_name: "Merica")
end
let(:profile_date) { 10.days.ago }
let(:promulgation_date) { 9.days.ago.to_date }

let!(:rating2) do
Generators::PromulgatedRating.build(
participant_id: veteran_with_ratings.participant_id,
promulgation_date: promulgation_date,
profile_date: profile_date,
issues: [
{ reference_id: "abc123", decision_text: "Left knee granted"},
{ reference_id: "def456", decision_text: "PTSD denied" },
{ reference_id: "def789", decision_text: "Looks like a VACOLS issue" }
],
decisions: [
{
rating_issue_reference_id: nil,
original_denial_date: promulgation_date - 35.days,
diagnostic_text: "Broken arm",
diagnostic_type: "Bone",
disability_id: "123",
disability_date: promulgation_date - 10.days,
type_name: "Not Service Connected"
}
]
)
end

let(:future_date) { (Time.zone.now + 30.days).to_date }
let(:receipt_date) { (post_ama_start_date - 30.days).to_date }
let(:untimely_days) { 372.days }
Expand All @@ -42,7 +73,9 @@

let!(:rating) { generate_rating(veteran, promulgation_date, profile_date) }
let!(:untimely_rating) { generate_untimely_rating(veteran, untimely_promulgation_date, untimely_profile_date) }
let!(:untimely_rating2) { generate_untimely_rating(veteran_with_ratings, untimely_promulgation_date, untimely_profile_date) }
let!(:before_ama_rating) { generate_pre_ama_rating(veteran) }
let!(:before_ama_rating2) { generate_pre_ama_rating(veteran_with_ratings) }

let(:no_ratings_err) { Rating::NilRatingProfileListError.new("none!") }

Expand Down Expand Up @@ -70,7 +103,7 @@

expect(page).to have_content(search_page_title)

fill_in search_bar_title, with: veteran_file_number
fill_in search_bar_title, with: veteran_with_ratings.file_number

click_on "Search"
expect(page).to have_current_path("/intake/review_request")
Expand Down Expand Up @@ -109,9 +142,8 @@

click_intake_continue

appeal = Appeal.find_by(veteran_file_number: veteran_file_number)
intake = Intake.find_by(veteran_file_number: veteran_file_number)

appeal = Appeal.find_by(veteran_file_number: veteran_with_ratings.file_number)
intake = Intake.find_by(veteran_file_number: veteran_with_ratings.file_number)
expect(appeal).to_not be_nil
expect(appeal.receipt_date.to_date).to eq(receipt_date.to_date)
expect(appeal.docket_type).to eq(Constants.AMA_DOCKETS.evidence_submission)
Expand Down Expand Up @@ -287,14 +319,14 @@ def complete_appeal
let(:disability_profile_date) { profile_date - 1.day }
let!(:ratings_with_diagnostic_codes) do
generate_ratings_with_disabilities(
veteran,
veteran_with_ratings,
disabiliity_receive_date,
disability_profile_date
)
end

scenario "saves diagnostic codes" do
appeal, = start_appeal(veteran)
appeal, = start_appeal(veteran_with_ratings)
visit "/intake"
click_intake_continue
save_and_check_request_issues_with_diagnostic_codes(
Expand Down Expand Up @@ -330,9 +362,9 @@ def complete_appeal
promulgation_date = receipt_date - 40.days
rating_date = promulgation_date.mdY

generate_timely_rating(veteran, receipt_date, duplicate_reference_id)
generate_untimely_rating_from_ramp(veteran, receipt_date, old_reference_id)
generate_rating_before_ama_from_ramp(veteran)
generate_timely_rating(veteran_with_ratings, receipt_date, duplicate_reference_id)
generate_untimely_rating_from_ramp(veteran_with_ratings, receipt_date, old_reference_id)
generate_rating_before_ama_from_ramp(veteran_with_ratings)

epe = create(:end_product_establishment, :active)
request_issue_in_progress = create(
Expand All @@ -342,13 +374,10 @@ def complete_appeal
contested_issue_description: "Old injury"
)

appeal, = start_appeal(veteran)
appeal, = start_appeal(veteran_with_ratings)
visit "/intake/add_issues"

expect(page).to have_content("Add / Remove Issues")
check_row("Review option", "Evidence Submission")
check_row("Claimant", "Ed Merica, Veteran")
check_row("SOC/SSOC Opt-in", "No")

# clicking the add issues button should bring up the modal
click_intake_add_issue
Expand Down Expand Up @@ -495,7 +524,7 @@ def complete_appeal

expect(Appeal.find_by(
id: appeal.id,
veteran_file_number: veteran.file_number,
veteran_file_number: veteran_with_ratings.file_number,
established_at: Time.zone.now
)).to_not be_nil

Expand Down Expand Up @@ -577,7 +606,7 @@ def complete_appeal
end

context "when veteran chooses decision issue from a previous appeal" do
let(:previous_appeal) { create(:appeal, :outcoded, veteran: veteran) }
let(:previous_appeal) { create(:appeal, :outcoded, veteran: veteran_with_ratings) }
let(:appeal_reference_id) { "appeal123" }
let!(:previous_appeal_request_issue) do
create(
Expand All @@ -594,7 +623,7 @@ def complete_appeal
decision_review: previous_appeal,
request_issues: [previous_appeal_request_issue],
rating_issue_reference_id: appeal_reference_id,
participant_id: veteran.participant_id,
participant_id: veteran_with_ratings.participant_id,
description: "appeal decision issue",
decision_text: "appeal decision issue",
benefit_type: "compensation",
Expand All @@ -604,7 +633,7 @@ def complete_appeal

scenario "the issue is ineligible" do
start_appeal(
veteran,
veteran_with_ratings,
veteran_is_not_claimant: false
)
visit "/intake/add_issues"
Expand All @@ -630,7 +659,7 @@ def complete_appeal
end

it "Shows a review error when something goes wrong" do
start_appeal(veteran)
start_appeal(veteran_with_ratings)
visit "/intake/add_issues"

click_intake_add_issue
Expand Down Expand Up @@ -678,7 +707,7 @@ def complete_appeal
end

scenario "adding nonrating issue with non-comp benefit type" do
_, intake = start_appeal(veteran)
_, intake = start_appeal(veteran_with_ratings)
visit "/intake/add_issues"

expect(page).to have_content("Add / Remove Issues")
Expand Down Expand Up @@ -720,14 +749,13 @@ def complete_appeal

context "with active legacy appeal" do
before do
setup_legacy_opt_in_appeals(veteran.file_number)
setup_legacy_opt_in_appeals(veteran_with_ratings.file_number)
end

context "with legacy_opt_in_approved" do
let(:receipt_date) { Time.zone.today }

scenario "adding issues" do
start_appeal(veteran, legacy_opt_in_approved: true)
start_appeal(veteran_with_ratings, legacy_opt_in_approved: true)
visit "/intake/add_issues"

check_row("SOC/SSOC Opt-in", "Yes")
Expand Down Expand Up @@ -808,8 +836,11 @@ def complete_appeal
end

context "with legacy opt in not approved" do
let!(:promulgation_date) { receipt_date - untimely_days - 1.day }
let(:profile_date) { receipt_date - untimely_days - 3.days }

scenario "adding issues" do
start_appeal(veteran, legacy_opt_in_approved: false)
start_appeal(veteran_with_ratings, legacy_opt_in_approved: false)
visit "/intake/add_issues"
click_intake_add_issue
add_intake_rating_issue("Left knee granted")
Expand Down Expand Up @@ -848,31 +879,36 @@ def complete_appeal
let(:prior_noncomp_decision_review) do
create(:higher_level_review,
benefit_type: "nca",
veteran_file_number: veteran_no_ratings.file_number)
veteran_file_number: veteran_with_ratings.file_number)
end

# decision_issue_date needs to be before receipt date to show up
let(:decision_issue_date) { receipt_date - 2.days }
let(:decision_issue_date) { receipt_date - 30.days }
let!(:decision_issues) do
[
# non comp decision issues do not have end_product_last_action date
# but do have promulgation date
create(:decision_issue,
disposition: "Granted",
description: "granted issue",
participant_id: veteran_no_ratings.participant_id,
decision_review: prior_noncomp_decision_review,
caseflow_decision_date: decision_issue_date),
create(:decision_issue,
disposition: "Dismissed",
description: "dismissed issue",
participant_id: veteran_no_ratings.participant_id,
decision_review: prior_noncomp_decision_review,
caseflow_decision_date: decision_issue_date)
create(
:decision_issue,
disposition: "Granted",
description: "granted issue",
participant_id: veteran_with_ratings.participant_id,
decision_review: prior_noncomp_decision_review,
caseflow_decision_date: decision_issue_date
),
create(
:decision_issue,
disposition: "Dismissed",
description: "dismissed issue",
participant_id: veteran_with_ratings.participant_id,
decision_review: prior_noncomp_decision_review,
caseflow_decision_date: decision_issue_date
)
]
end

it "shows prior decision issues as contestable" do
start_appeal(veteran_no_ratings)
start_appeal(veteran_with_ratings)

visit "/intake/add_issues"
click_intake_add_issue
Expand All @@ -885,16 +921,16 @@ def complete_appeal
context "has a chain of prior decision issues" do
let(:start_date) { Time.zone.today - 300.days }
before do
prior_appeal = create(:appeal, :outcoded, veteran: veteran)
prior_appeal = create(:appeal, :outcoded, veteran: veteran_with_ratings)
request_issue = create(:request_issue,
contested_rating_issue_reference_id: "old123",
contested_rating_issue_profile_date: untimely_rating.profile_date,
decision_review: prior_appeal)
setup_prior_decision_issue_chain(prior_appeal, request_issue, veteran, start_date)
setup_prior_decision_issue_chain(prior_appeal, request_issue, veteran_with_ratings, start_date)
end

it "disables prior contestable issues" do
start_appeal(veteran)
start_appeal(veteran_with_ratings)
check_decision_issue_chain(start_date)
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/feature/intake/supplemental_claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ def start_supplemental_claim(

VeteranClaimant.create!(
decision_review: supplemental_claim,
participant_id: test_veteran.participant_id
participant_id: test_veteran.participant_id,
payee_code: "11"
)

supplemental_claim.start_review!
Expand Down

0 comments on commit c83b699

Please sign in to comment.