Skip to content

Commit

Permalink
Bugfix/15134 set response body (#15287)
Browse files Browse the repository at this point in the history
* #15134

See #15075 and department-of-veterans-affairs/va.gov-team#65182 for the
Original PR and Github Issue, respectively.

This PR exposes a `body` attribute on the `GiBillStatusResponse` object, so it can be logged out as intended in the original PR.
  • Loading branch information
AdamKing0126 authored and Steven Cumming committed Feb 21, 2024
1 parent f5933e6 commit f1d53ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/evss/gi_bill_status/gi_bill_status_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def error_type
'unknown'
end

def body
@response.body
end

private

def timeout?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,16 @@
end

it 'raises an InternalServerError including an exception with a detailed message' do
expect_block = expect do
response = instance_double(EVSS::GiBillStatus::GiBillStatusResponse)
allow(response).to receive(:error_type).and_return('unknown')
allow(response).to receive(:status).and_return(500)
allow(response).to receive(:body).and_return('Unknown error')

expectation = expect do
controller.send(:render_error_json, response)
end

expect_block.to raise_error(Common::Exceptions::InternalServerError) do |error|
expectation.to raise_error(Common::Exceptions::InternalServerError) do |error|
expected_msg = 'An unknown error occurred. Response error type: unknown, status: 500, body: Unknown error'
expect(error.exception.message).to eq(expected_msg)
end
Expand Down

0 comments on commit f1d53ec

Please sign in to comment.