Skip to content

Commit

Permalink
https://github.com/department-of-veterans-affairs/vets-api/issues/15134
Browse files Browse the repository at this point in the history
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 committed Jan 16, 2024
1 parent 7104c54 commit e5dd379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 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 @@ -113,6 +113,10 @@ def error_type
'unknown'
end

def body
@response.body
end

private

def timeout?
Expand Down
11 changes: 7 additions & 4 deletions spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@
end

it 'raises an InternalServerError including an exception with a detailed message' do
expect_block = expect do
response = instance_double("EVSS::GiBillStatus::GiBillStatusResponse")

Check failure on line 139 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

RSpec/VerifiedDoubleReference: Use a constant class reference for verified doubles.

Check failure on line 139 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
allow(response).to receive(:error_type).and_return("unknown")

Check failure on line 140 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
allow(response).to receive(:status).and_return(500)
allow(response).to receive(:body).and_return("Unknown error")

Check failure on line 142 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

Check failure on line 143 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/TrailingWhitespace: Trailing whitespace detected.
expect do
controller.send(:render_error_json, response)
end

expect_block.to raise_error(Common::Exceptions::InternalServerError) do |error|
end.to raise_error(Common::Exceptions::InternalServerError) do |error|

Check failure on line 146 in spec/controllers/v0/post911_gi_bill_statuses_controller_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/MultilineBlockChain: Avoid multi-line chains of blocks.
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 e5dd379

Please sign in to comment.