Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
pixiitech committed Jan 21, 2025
1 parent edafbb1 commit 98ab588
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def load_response_fixture(path_suffix)

resolution.power_of_attorney_request
end
let(:time) { '2024-12-21T04:45:37Z' }
let(:time_plus_one_day) { '2024-12-22T04:45:37Z' }
let(:time) { '2024-12-21T04:45:37.000Z' }
let(:time_plus_one_day) { '2024-12-22T04:45:37.000Z' }
let(:expires_at) { '2025-02-19T04:45:37.000Z' }

let(:poa_requests) do
Expand Down Expand Up @@ -184,14 +184,15 @@ def load_response_fixture(path_suffix)

context 'when providing a status param' do
let!(:declined_request) { create(:power_of_attorney_request, :with_declination) }
let!(:pending_request) { create(:power_of_attorney_request, skip_resolution: true) }
let!(:pending_request) { create(:power_of_attorney_request) }

it 'returns the list of pending power of attorney requests' do
get('/accredited_representative_portal/v0/power_of_attorney_requests?status=pending')
parsed_response = JSON.parse(response.body)
expect(response).to have_http_status(:ok)
expect(parsed_response.length).to eq 1
expect(parsed_response[0]['id']).to eq pending_request.id
expect(parsed_response.length).to eq 2
expect(parsed_response.map { |poa| poa['id'] }).to include(pending_request.id)
expect(parsed_response.map { |poa| poa['id'] }).not_to include(declined_request.id)
end

it 'returns the list of completed power of attorney requests' do
Expand All @@ -211,6 +212,12 @@ def load_response_fixture(path_suffix)

describe 'GET /accredited_representative_portal/v0/power_of_attorney_requests/:id' do
let(:poa_request) { create(:power_of_attorney_request, :with_declination) }
let(:power_of_attorney_form) do
poa_request.power_of_attorney_form.parsed_data.tap do |data|
data.delete('dependent')
data['claimant'] = data.delete('veteran')
end
end

it 'returns the details of a specific power of attorney request' do
get("/accredited_representative_portal/v0/power_of_attorney_requests/#{poa_request.id}")
Expand All @@ -222,7 +229,7 @@ def load_response_fixture(path_suffix)
'claimant_id' => poa_request.claimant_id,
'created_at' => time,
'expires_at' => nil,
'power_of_attorney_form' => veteran_claimant_power_of_attorney_form,
'power_of_attorney_form' => power_of_attorney_form,
'resolution' => {
'id' => poa_request.resolution.id,
'type' => 'decision',
Expand Down

0 comments on commit 98ab588

Please sign in to comment.