Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BGS representative in all Hearings Jobs #15083

Merged
merged 3 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions app/models/legacy_appeal_representative.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def representative_to_hash
def use_representative_info_from_bgs?
RequestStore.store[:application] == "queue" ||
RequestStore.store[:application] == "hearings" ||
RequestStore.store[:application] == "hearing_schedule_job" ||
RequestStore.store[:application] == "idt"
end

Expand Down
47 changes: 47 additions & 0 deletions spec/jobs/virtual_hearings/create_conference_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,52 @@
)
end
end

context "for a legacy hearings" do
let(:appeal) do
create(
:legacy_appeal,
:with_veteran,
vacols_case: create(:case)
)
end
let!(:representative) do
create(
:representative,
repfirst: "Serrif",
replast: "Gnest",
repkey: appeal.vacols_id
)
end
let(:hearing) { create(:legacy_hearing, appeal: appeal) }

context "when representative is different in VACOLS and VBMS" do
it "uses the representative in VBMS" do
# Sanity check that calling `LegacyAppeal#representative_name` returns the
# VACOLS value if the `RequestStore.store[:application]` isn't set
expect(appeal.representative_name).to eq("Serrif Gnest")

expect(MailRecipient).to(
receive(:new)
.with(instance_of(Hash))
.twice
.and_call_original
)
expect(MailRecipient).to(
receive(:new)
.with(
hash_including(
name: FakeConstants.BGS_SERVICE.DEFAULT_POA_NAME,
title: MailRecipient::RECIPIENT_TITLES[:representative]
)
)
.once
.and_call_original
)

subject.perform_now
end
end
end
end
end