Skip to content

Commit

Permalink
Reorganize ClaimsApi Request Specs (#18216)
Browse files Browse the repository at this point in the history
* move/rename files + update example group name with convention ClaimsApi v1 + docs

* move/rename files + update example group name with convention ClaimsApi v2

* lint

* move/rename files + update example group name with convention ClaimsApi

* linting

* Refactor PDFStamper to use instance methods (#18167)

* Refactor PDFStamper to use instance methods

* lint

* lint

* lint

* tests

* Refactor 40-10007 too

* tests

* lint

* More refactoring/linting

* lint

* lint

* Update modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb

Co-authored-by: Jacob Penner <[email protected]>

* remove extra method

* Fix stamping date

* lint

* booleans are hard

* tests

---------

Co-authored-by: Jacob Penner <[email protected]>

* [DBX-18202] tune 526 failure_type for performance (#18213)

* [DBX-18202] tune 526 failure_type for performance

* general save

* general save

* general save

* general save

* API 38963 Hardcode VnpPtcpntAddrsWebServiceBean (#18034)

* Hardcode VnpPtcpntAddrsWebServiceBean

* Add spec

* Alpha order and prepare for merges

* API-38964-hardcode-VnpPtcpntPhoneService  (#18023)

* Adds VnpPtcpntPhoneService to definitions.rb. Adds VnpPtcpntPhoneService to CACHED_SERVICES. Adds tests.

* Hardcode VnpPtcpntAddrsWebServiceBean

* Add spec

* Alpha order and prepare for merges

* API-38535-hardcode-manage-rep-serv (#17990)

* Adds bean & service to cached_services. Adds tests for ManageRepresentativeService.

* Linting fix

* Corrects bean/service pattern in local_bgs. Corrects spelling in find_definitions. Corrects bean name in tests.

* Corrects linting

* Get institutions from VES Oracle DB in CSVs on S3

* Create institution DB entries from S3 CSVs

* Filter out Lighthouse Facilities not in VES

* add new spec to CODEOWNERS

* exclude deactivated facilities

* rubocop fixes

* UNDO test scheduled run

* later test time

* set test time

* extract VES filtering logic to helper method

* filter facilities based on additional flag

* reset job times

* rubocop fix

* test fix

* Invert default behavior - filter without a flag

* PR feedback cleanup

* remove overly-defensive param; PR cleanup

* rubocop fix

* add StatsD monitoring for job completion

* clarify station number parsing from ID

* remove github script - moved to ves-oracle-export repo

* simplify out station_number logic, deferring to BaseFacility for the id split

* reschedule job for 4:30pm ET, since the export is at 4

* Add lighthouse_claims_api_poa_dependent_claimants (#18176)

Add the `lighthouse_claims_api_poa_dependent_claimants` feature flag.

* API-39304-update-regex-to-match-EVSS-docker-container (#18149)

* Updates regex to match EVSS docker container

* Updates schema to match https://files.slack.com/files-pri/T1ZD0UBMZ-F072RFM691C/evss_docker_swagger.yaml

* Adjusts maxLength to match EVSS schema. Adds docs.

* Create MilitaryInformationHistory model (#18150)

* Create MilitaryInformationHistory model

* Update type of Array

---------

Co-authored-by: Tonksthebear <[email protected]>

* Mobile: Deprecate healthcare_service (#18085)

* Deprecate healthcare_service

* Rubocop

---------

Co-authored-by: Tonksthebear <[email protected]>

* Country_code (#18158)

* add

* indent

* brakeman

* alignment

* Update Gemfile.lock brakeman

brakeman change from 6.1.2 to 6.2.1

* Pensions 82564 pdf fill 3 (#18041)

* Add 0969 unassociated incomes to PDF mapping

* Update vets-json-schema

* Handle lint errors

* Update 0969 merge fields

* API-38958-hardcode-vet-rep-serv (#17997)

* Adds VDC/VeteranRepresentativeService to CACHED_SERVICES. Adds tests.

* Update find_definitions_spec.rb

* Linting

* Linting

* Extract request preferred dates from requested periods (#18171)

* Extract request preferred dates from requested periods

* Add unit tests

* Lint

* 85683: Allow multiple claims to be created in one submission (#18173)

* Adds find_tracked_item to TrackedItems. Adds a test for that method. (#18130)

* adds sign in feature toggle (#18151)

* adds sign in feature toggle

* renames feature

---------

Co-authored-by: Alexander Garcia <[email protected]>

* Api 39220 preserve form data (#18128)

* API-39220-preserve-form-data

* Adds function to preserve the original form data in the case we get an error during establishment
* Adds tests for new method
	modified:   modules/claims_api/app/sidekiq/claims_api/claim_establisher.rb
	modified:   modules/claims_api/app/sidekiq/claims_api/service_base.rb
	modified:   modules/claims_api/spec/sidekiq/claim_establisher_spec.rb
	modified:   modules/claims_api/spec/sidekiq/service_base_spec.rb

* Updates a comment

* Updates a comment

* Switches up the approach thanks to PR suggestions

* Found a, perhaps, better alternative n deep_dup that still works as expected

* Reverts Gemfile.lock change

---------

Co-authored-by: Jennica Stiehl <[email protected]>

* Bump tj-actions/changed-files from 44 to 45 (#18178)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 44 to 45.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v44...v45)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add toggles for new debt team notification items (#18172)

* replace mhv notification toggles with new ones

* add toggles for new debt team notification items

* replace mhv notification toggles with new ones (#18141)

* add pagination to InquiriesController#index (#18189)

Co-authored-by: khoa-v-nguyen <[email protected]>

* Direct deposit legacy cleanup (#17857)

* cleanup old disability-compensation files (replaced by direct-deposit)

* Update VCR cassettes; remove unused ControlInformation model; update swagger specs

* Remove reference to control_information

* Hide the domain in vcr cassettes

* Add codeowners va-api-engineers backend-review-group to config/initializers/integration_recorder.rb

* Bump rubocop-rails from 2.25.1 to 2.26.0 (#18180)

* Bump rubocop-rails from 2.25.1 to 2.26.0

Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.25.1 to 2.26.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](rubocop/rubocop-rails@v2.25.1...v2.26.0)

---
updated-dependencies:
- dependency-name: rubocop-rails
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* RuboCop Auto-Correct: Rails/PluralizationGrammar

* RuboCop Auto-Correct: Rails/CompactBlank

* RuboCop Auto-Correct: Rails/RootPathnameMethods

* chore: Add Rakefile to CODEOWNERS

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Boehs <[email protected]>

* Update test JSON - form 10-10d (#18148)

* updated test json

* updates

* 90103: Add record status metrics for DR SavedClaim updater jobs (#18177)

* Created VCR cassettes for the mobile profile upgrade for V2::ContactInformation::Service (#18174)

* Check for icn when submitting 26-4555 (#18181)

* Adds VnpAtchmsWebServiceBean/VnpAtchmsService to definitions and CACHED_SERVICES. Adds tests. (#18000)

* Adds vnpPersonCreate from VnpPersonWebServiceBean/VnpPersonService. Adds tests. (#18002)

* Alpha order and prepare for merges

* Remove extra file

* Fix missing merge

* Fix merge again

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Mitch Saltykov <[email protected]>
Co-authored-by: Tyler <[email protected]>
Co-authored-by: Jason C <[email protected]>
Co-authored-by: Tonksthebear <[email protected]>
Co-authored-by: Don Shin <[email protected]>
Co-authored-by: Tai Wilkin-Corraggio <[email protected]>
Co-authored-by: John Luo <[email protected]>
Co-authored-by: Bryan Alexander <[email protected]>
Co-authored-by: Caitlin <[email protected]>
Co-authored-by: Alexander Garcia <[email protected]>
Co-authored-by: Rockwell Windsor Rice <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: asiisii <[email protected]>
Co-authored-by: Khoa Nguyen <[email protected]>
Co-authored-by: khoa-v-nguyen <[email protected]>
Co-authored-by: Tom Harrison <[email protected]>
Co-authored-by: Eric Boehs <[email protected]>
Co-authored-by: Michael Clement <[email protected]>
Co-authored-by: dfong-adh <[email protected]>
Co-authored-by: Rachal Cassity <[email protected]>
Co-authored-by: Eric Tillberg <[email protected]>

* API-38965-hardcode-VnpPtcpntService (#18027)

* Adds VnpPtcpntPhoneService to definitions.rb. Adds VnpPtcpntPhoneService to CACHED_SERVICES. Adds tests.

* Adds VnpPtcpntService to definitions. Adds VnpPtcpntService to cached_services. Adds tests.

* Hardcode VnpPtcpntAddrsWebServiceBean

* Add spec

* Alpha order and prepare for merges

* API-38535-hardcode-manage-rep-serv (#17990)

* Adds bean & service to cached_services. Adds tests for ManageRepresentativeService.

* Linting fix

* Corrects bean/service pattern in local_bgs. Corrects spelling in find_definitions. Corrects bean name in tests.

* Corrects linting

* Get institutions from VES Oracle DB in CSVs on S3

* Create institution DB entries from S3 CSVs

* Filter out Lighthouse Facilities not in VES

* add new spec to CODEOWNERS

* exclude deactivated facilities

* rubocop fixes

* UNDO test scheduled run

* later test time

* set test time

* extract VES filtering logic to helper method

* filter facilities based on additional flag

* reset job times

* rubocop fix

* test fix

* Invert default behavior - filter without a flag

* PR feedback cleanup

* remove overly-defensive param; PR cleanup

* rubocop fix

* add StatsD monitoring for job completion

* clarify station number parsing from ID

* remove github script - moved to ves-oracle-export repo

* simplify out station_number logic, deferring to BaseFacility for the id split

* reschedule job for 4:30pm ET, since the export is at 4

* Add lighthouse_claims_api_poa_dependent_claimants (#18176)

Add the `lighthouse_claims_api_poa_dependent_claimants` feature flag.

* API-39304-update-regex-to-match-EVSS-docker-container (#18149)

* Updates regex to match EVSS docker container

* Updates schema to match https://files.slack.com/files-pri/T1ZD0UBMZ-F072RFM691C/evss_docker_swagger.yaml

* Adjusts maxLength to match EVSS schema. Adds docs.

* Create MilitaryInformationHistory model (#18150)

* Create MilitaryInformationHistory model

* Update type of Array

---------

Co-authored-by: Tonksthebear <[email protected]>

* Mobile: Deprecate healthcare_service (#18085)

* Deprecate healthcare_service

* Rubocop

---------

Co-authored-by: Tonksthebear <[email protected]>

* Country_code (#18158)

* add

* indent

* brakeman

* alignment

* Update Gemfile.lock brakeman

brakeman change from 6.1.2 to 6.2.1

* Pensions 82564 pdf fill 3 (#18041)

* Add 0969 unassociated incomes to PDF mapping

* Update vets-json-schema

* Handle lint errors

* Update 0969 merge fields

* API-38958-hardcode-vet-rep-serv (#17997)

* Adds VDC/VeteranRepresentativeService to CACHED_SERVICES. Adds tests.

* Update find_definitions_spec.rb

* Linting

* Linting

* Extract request preferred dates from requested periods (#18171)

* Extract request preferred dates from requested periods

* Add unit tests

* Lint

* 85683: Allow multiple claims to be created in one submission (#18173)

* Adds find_tracked_item to TrackedItems. Adds a test for that method. (#18130)

* adds sign in feature toggle (#18151)

* adds sign in feature toggle

* renames feature

---------

Co-authored-by: Alexander Garcia <[email protected]>

* Api 39220 preserve form data (#18128)

* API-39220-preserve-form-data

* Adds function to preserve the original form data in the case we get an error during establishment
* Adds tests for new method
	modified:   modules/claims_api/app/sidekiq/claims_api/claim_establisher.rb
	modified:   modules/claims_api/app/sidekiq/claims_api/service_base.rb
	modified:   modules/claims_api/spec/sidekiq/claim_establisher_spec.rb
	modified:   modules/claims_api/spec/sidekiq/service_base_spec.rb

* Updates a comment

* Updates a comment

* Switches up the approach thanks to PR suggestions

* Found a, perhaps, better alternative n deep_dup that still works as expected

* Reverts Gemfile.lock change

---------

Co-authored-by: Jennica Stiehl <[email protected]>

* Bump tj-actions/changed-files from 44 to 45 (#18178)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 44 to 45.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v44...v45)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add toggles for new debt team notification items (#18172)

* replace mhv notification toggles with new ones

* add toggles for new debt team notification items

* replace mhv notification toggles with new ones (#18141)

* add pagination to InquiriesController#index (#18189)

Co-authored-by: khoa-v-nguyen <[email protected]>

* Direct deposit legacy cleanup (#17857)

* cleanup old disability-compensation files (replaced by direct-deposit)

* Update VCR cassettes; remove unused ControlInformation model; update swagger specs

* Remove reference to control_information

* Hide the domain in vcr cassettes

* Add codeowners va-api-engineers backend-review-group to config/initializers/integration_recorder.rb

* Bump rubocop-rails from 2.25.1 to 2.26.0 (#18180)

* Bump rubocop-rails from 2.25.1 to 2.26.0

Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.25.1 to 2.26.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](rubocop/rubocop-rails@v2.25.1...v2.26.0)

---
updated-dependencies:
- dependency-name: rubocop-rails
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* RuboCop Auto-Correct: Rails/PluralizationGrammar

* RuboCop Auto-Correct: Rails/CompactBlank

* RuboCop Auto-Correct: Rails/RootPathnameMethods

* chore: Add Rakefile to CODEOWNERS

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Boehs <[email protected]>

* Update test JSON - form 10-10d (#18148)

* updated test json

* updates

* 90103: Add record status metrics for DR SavedClaim updater jobs (#18177)

* Created VCR cassettes for the mobile profile upgrade for V2::ContactInformation::Service (#18174)

* Check for icn when submitting 26-4555 (#18181)

* Adds VnpAtchmsWebServiceBean/VnpAtchmsService to definitions and CACHED_SERVICES. Adds tests. (#18000)

* Adds vnpPersonCreate from VnpPersonWebServiceBean/VnpPersonService. Adds tests. (#18002)

* Alpha order and prepare for merges

* Remove extra file

* Fix missing merge

* Fix merge again

* Fix person vs vnpPerson spec

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Mitch Saltykov <[email protected]>
Co-authored-by: Tyler <[email protected]>
Co-authored-by: Jason C <[email protected]>
Co-authored-by: Tonksthebear <[email protected]>
Co-authored-by: Don Shin <[email protected]>
Co-authored-by: Tai Wilkin-Corraggio <[email protected]>
Co-authored-by: John Luo <[email protected]>
Co-authored-by: Bryan Alexander <[email protected]>
Co-authored-by: Caitlin <[email protected]>
Co-authored-by: Alexander Garcia <[email protected]>
Co-authored-by: Rockwell Windsor Rice <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: asiisii <[email protected]>
Co-authored-by: Khoa Nguyen <[email protected]>
Co-authored-by: khoa-v-nguyen <[email protected]>
Co-authored-by: Tom Harrison <[email protected]>
Co-authored-by: Eric Boehs <[email protected]>
Co-authored-by: Michael Clement <[email protected]>
Co-authored-by: dfong-adh <[email protected]>
Co-authored-by: Rachal Cassity <[email protected]>
Co-authored-by: Eric Tillberg <[email protected]>

* removed cst_use_claim_details_v2 from features.yml (#18144)

* API-39216-helper-concern (#18164)

* Extracts methods from the claims_controller to a helper methods module. Adds test for the new module.

* Moves build_tracked_item from assistance module to tracked_items module, and corresponding tests.

* Updates variable name from d to parsed_date based on Reek's recommendation.

* 91327: Fix metric tag for DR SavedClaim status updater jobs (#18208)

* Remove ch33 files (#18054)

* remove CH33 related code and cassettes

* Remove ch33_bank_account_serializer

* remove ch33_bank_account routes/swagger

* codeowners for bank_name_spec

* Remove context with out examples

* Remove more ch33 files

* Remove a few more references to deleted fields/methods

* Delete a few schema refs I missed

---------

Co-authored-by: Tom Harrison <[email protected]>

* API-39386-remove-disability-tx-matching-validation (#18205)

* Removes treated disability name matching validation from modules/claims_api/app/controllers/concerns/claims_api/v2/disability_compensation_validation.rb. Removes related tests from modules/claims_api/spec/requests/v2/veterans/disability_compensation_request_spec.rb. Updates description in modules/claims_api/config/schemas/v2/526.json.

* Updates description in modules/claims_api/config/schemas/v2/generate_pdf_526.json.

* Updates dev/swagger.json & production/swagger.json.

* chore: Rearrange comments in peroidic jobs (#18212)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Eric Tillberg <[email protected]>
Co-authored-by: Jacob Penner <[email protected]>
Co-authored-by: Sam Stuckey <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Jennica Stiehl <[email protected]>
Co-authored-by: Austin Covrig <[email protected]>
Co-authored-by: Mitch Saltykov <[email protected]>
Co-authored-by: Tyler <[email protected]>
Co-authored-by: Jason C <[email protected]>
Co-authored-by: Tonksthebear <[email protected]>
Co-authored-by: Don Shin <[email protected]>
Co-authored-by: Tai Wilkin-Corraggio <[email protected]>
Co-authored-by: John Luo <[email protected]>
Co-authored-by: Bryan Alexander <[email protected]>
Co-authored-by: Caitlin <[email protected]>
Co-authored-by: Alexander Garcia <[email protected]>
Co-authored-by: Rockwell Windsor Rice <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: asiisii <[email protected]>
Co-authored-by: Khoa Nguyen <[email protected]>
Co-authored-by: khoa-v-nguyen <[email protected]>
Co-authored-by: Tom Harrison <[email protected]>
Co-authored-by: Eric Boehs <[email protected]>
Co-authored-by: Michael Clement <[email protected]>
Co-authored-by: dfong-adh <[email protected]>
Co-authored-by: Rachal Cassity <[email protected]>
Co-authored-by: samcoforma <[email protected]>
Co-authored-by: Ryan McNeil <[email protected]>
  • Loading branch information
1 parent fcbe853 commit a112804
Show file tree
Hide file tree
Showing 25 changed files with 582 additions and 601 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'Claims Status Documentation Endpoint', type: :request do
RSpec.describe 'ClaimsApi::Docs::V1::Api', type: :request do
describe '#get /docs/v1/api' do
it 'returns Open API Spec v3 JSON' do
get '/services/claims/docs/v1/api'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'bgs/services'
require 'mpi/service'

RSpec.describe 'Claims Status Metadata Endpoint', type: :request do
RSpec.describe 'ClaimsApi::Metadata', type: :request do
describe '#get /metadata' do
it 'returns metadata JSON' do
get '/services/claims/metadata'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rails_helper'
require_relative '../../rails_helper'

RSpec.describe 'BGS Claims management', type: :request do
RSpec.describe 'ClaimsApi::V1::Claims', type: :request do
include SchemaMatchers

let(:request_headers) do
Expand Down Expand Up @@ -73,7 +73,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/claims/claims_with_errors') do
get '/services/claims/v1/claims', params: nil, headers: request_headers.merge(auth_header)
expect(response.status).to eq(404)
expect(response).to have_http_status(:not_found)
end
end
end
Expand Down Expand Up @@ -187,7 +187,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/claims/claim_with_errors') do
get '/services/claims/v1/claims/123123131', params: nil, headers: request_headers.merge(auth_header)
expect(response.status).to eq(404)
expect(response).to have_http_status(:not_found)
end
end
end
Expand All @@ -212,7 +212,7 @@

get '/services/claims/v1/claims/123123131', params: nil, headers: request_headers.merge(auth_header)

expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
body = JSON.parse(response.body)
expect(body['errors'][0]['detail']).to eq('Unable to locate Veteran in Master Person Index (MPI). ' \
'Please submit an issue at ask.va.gov or call ' \
Expand All @@ -238,7 +238,7 @@

get '/services/claims/v1/claims/123123131', params: nil, headers: request_headers.merge(auth_header)

expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
body = JSON.parse(response.body)
expect(body['errors'][0]['detail']).to eq('Veteran missing Integration Control Number (ICN). ' \
'Please submit an issue at ask.va.gov or call 1-800-MyVA411 ' \
Expand All @@ -259,7 +259,7 @@
VCR.use_cassette('claims_api/bgs/claims/claim') do
headers = request_headers.merge(auth_header)
get('/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9', params: nil, headers:)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
Expand All @@ -276,7 +276,7 @@
VCR.use_cassette('claims_api/bgs/claims/claim') do
headers = request_headers.merge(auth_header)
get('/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9', params: nil, headers:)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
Expand All @@ -287,12 +287,12 @@
it 'users the poa verifier when the header is present' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/claims/claim') do
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
verifier_stub = instance_double(BGS::PowerOfAttorneyVerifier)
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
headers = request_headers.merge(auth_header)
get("/services/claims/v1/claims/#{bgs_claim_id}", params: nil, headers:)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
end
end
Expand All @@ -301,7 +301,7 @@
context 'with oauth user and no headers' do
it 'lists all Claims', run_at: 'Tue, 12 Dec 2017 03:09:06 GMT' do
mock_acg(scopes) do |auth_header|
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
verifier_stub = instance_double(BGS::PowerOfAttorneyVerifier)
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
VCR.use_cassette('claims_api/bgs/claims/claims') do
Expand All @@ -315,7 +315,7 @@

it 'lists all Claims when camel-inflected', run_at: 'Tue, 12 Dec 2017 03:09:06 GMT' do
mock_acg(scopes) do |auth_header|
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
verifier_stub = instance_double(BGS::PowerOfAttorneyVerifier)
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
VCR.use_cassette('claims_api/bgs/claims/claims') do
Expand All @@ -334,7 +334,7 @@
headers: request_headers.merge(auth)
parsed_response = JSON.parse(response.body)

expect(response.status).to eq(401)
expect(response).to have_http_status(:unauthorized)
expect(parsed_response['errors'].first['title']).to eq('Not authorized')
end
end
Expand All @@ -347,7 +347,7 @@
get "/services/claims/v1/claims/#{bgs_claim_id}", params: nil, headers: request_headers.merge(auth_header)
body = JSON.parse(response.body)
events_timeline = body['data']['attributes']['events_timeline']
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(events_timeline[1]['type']).to eq('completed')
expect(events_timeline[2]['type']).to eq('filed')
end
Expand Down Expand Up @@ -385,7 +385,7 @@
VCR.use_cassette('bgs/claims/claim') do
headers = request_headers.merge(auth_header)
get('/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9', params: nil, headers:)
expect(response.status).not_to eq(404)
expect(response).not_to have_http_status(:not_found)
body = JSON.parse(response.body)
expect(body['errors'][0]['detail']).not_to eq('Claim not found')
expect(body['errors'][0]['source']).to eq('400')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require 'rails_helper'
require_relative '../../rails_helper'
require_relative '../../../rails_helper'
require 'bgs_service/local_bgs'

RSpec.describe 'Intent to file', type: :request do
RSpec.describe 'ClaimsApi::V1::Forms::0966', type: :request do
let(:headers) do
{ 'X-VA-SSN': '796-10-4437',
'X-VA-First-Name': 'WESLEY',
Expand All @@ -21,7 +21,7 @@
participant_claimant_id: '123_456_789',
received_date: '2015-01-05T17:42:12.058Z' }
end
let(:schema) { File.read(Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '0966.json')) }
let(:schema) { Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '0966.json').read }

before do
stub_poa_verification
Expand All @@ -41,7 +41,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/insert_intent_to_file') do
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)['data']['attributes']['status']).to eq('duplicate')
end
end
Expand All @@ -52,7 +52,7 @@
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/insert_intent_to_file') do
data[:data][:attributes] = extra
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)['data']['attributes']['status']).to eq('duplicate')
end
end
Expand All @@ -63,7 +63,7 @@
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/insert_intent_to_file_500') do
data[:data][:attributes] = { type: 'pension' }
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(404)
expect(response).to have_http_status(:not_found)
end
end
end
Expand All @@ -74,7 +74,7 @@
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/insert_intent_to_file') do
data[:data][:attributes] = { type: 'burial' }
post path, params: data.to_json, headers: auth_header
expect(response.status).to eq(403)
expect(response).to have_http_status(:forbidden)
end
end
end
Expand All @@ -84,7 +84,7 @@
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/insert_intent_to_file') do
data[:data][:attributes] = { type: 'burial' }
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(403)
expect(response).to have_http_status(:forbidden)
end
end
end
Expand All @@ -95,7 +95,7 @@
data[:attributes] = extra
data[:attributes][:type] = 'burial'
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
end
end
Expand All @@ -106,7 +106,7 @@
data[:data][:attributes][:type] = 'burial'
data[:data][:attributes][:claimant_ssn] = '123_456_789'
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
end
end
Expand All @@ -116,21 +116,21 @@
mock_acg(scopes) do |auth_header|
data[:data][:attributes][:type] = 'failingtesttype'
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end

it 'fails if none is passed in' do
mock_acg(scopes) do |auth_header|
post path, headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end

it 'fails if none is passed in as non-poa request' do
mock_acg(scopes) do |auth_header|
post path, headers: auth_header, params: ''
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end

Expand All @@ -140,7 +140,7 @@

post path, params: data.to_json, headers: headers.merge(auth_header)

expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
expect(JSON.parse(response.body)['errors'].size).to eq(1)
expect(JSON.parse(response.body)['errors'][0]['detail']).to eq(
'The property /someBadField is not defined on the schema. Additional properties are not allowed'
Expand Down Expand Up @@ -178,7 +178,7 @@
stub_mpi(build(:mpi_profile, participant_id: '999'))
end

it "'participant_claimant_id' is set to the target_veteran.participant_id and sent to BGS " do
it "'participant_claimant_id' is set to the target_veteran.participant_id and sent to BGS" do
expect_any_instance_of(ClaimsApi::LocalBGS)
.to receive(:insert_intent_to_file).with(hash_including(participant_claimant_id: '999')).and_return({})

Expand All @@ -189,7 +189,7 @@
end

context "when both 'participant_claimant_id' and 'claimant_ssn' are provided" do
it "both 'participant_claimant_id' and 'claimant_ssn' are sent to BGS " do
it "both 'participant_claimant_id' and 'claimant_ssn' are sent to BGS" do
expect_any_instance_of(ClaimsApi::LocalBGS)
.to receive(:insert_intent_to_file).with(
hash_including(
Expand All @@ -215,7 +215,7 @@
post path, params: data.to_json, headers: headers.merge(auth_header)
end.to change(ClaimsApi::IntentToFile, :count).by(1)
expect(ClaimsApi::IntentToFile.last.status).to eq(ClaimsApi::IntentToFile::SUBMITTED)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
end
end
Expand All @@ -230,7 +230,7 @@
post path, params: data.to_json, headers: headers.merge(auth_header)
end.to change(ClaimsApi::IntentToFile, :count).by(1)
expect(ClaimsApi::IntentToFile.last.status).to eq(ClaimsApi::IntentToFile::ERRORED)
expect(response.status).to eq(404)
expect(response).to have_http_status(:not_found)
end
end
end
Expand All @@ -247,7 +247,7 @@
it 'returns an unprocessible entity status' do
mock_acg(scopes) do |auth_header|
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
Expand All @@ -262,7 +262,7 @@
it 'returns an unprocessible entity status' do
mock_acg(scopes) do |auth_header|
post path, params: data.to_json, headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end
end
Expand All @@ -282,7 +282,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/get_intent_to_file') do
get "#{path}/active", params: { type: 'compensation' }, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)['data']['attributes']['status']).to eq('active')
end
end
Expand All @@ -292,7 +292,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/get_intent_to_file') do
get "#{path}/active", params: { type: 'pension' }, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)['data']['attributes']['status']).to eq('active')
end
end
Expand All @@ -302,7 +302,7 @@
mock_acg(scopes) do |auth_header|
VCR.use_cassette('claims_api/bgs/intent_to_file_web_service/get_intent_to_file') do
get "#{path}/active", params: { type: 'burial' }, headers: headers.merge(auth_header)
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)['data']['attributes']['status']).to eq('active')
end
end
Expand All @@ -311,21 +311,21 @@
it 'fails if passed with wrong type' do
mock_acg(scopes) do |auth_header|
get "#{path}/active", params: { type: 'test' }, headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end

it 'fails if none is passed in for poa request' do
mock_acg(scopes) do |auth_header|
get "#{path}/active", headers: headers.merge(auth_header)
expect(response.status).to eq(400)
expect(response).to have_http_status(:bad_request)
end
end

it 'fails if none is passed in for non-poa request' do
mock_acg(scopes) do |auth_header|
get "#{path}/active", headers: auth_header, params: ''
expect(response.status).to eq(400)
expect(response).to have_http_status(:bad_request)
end
end
end
Expand All @@ -344,15 +344,15 @@
mock_acg(scopes) do |auth_header|
post "#{path}/validate", params: { data: { attributes: nil } }.to_json, headers: headers.merge(auth_header)
parsed = JSON.parse(response.body)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
expect(parsed['errors']).not_to be_empty
end
end

it 'responds properly when JSON parse error' do
mock_acg(scopes) do |auth_header|
post "#{path}/validate", params: 'hello', headers: headers.merge(auth_header)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
end
end

Expand All @@ -364,7 +364,7 @@

post "#{path}/validate", params: data.to_json, headers: headers.merge(auth_header)
parsed = JSON.parse(response.body)
expect(response.status).to eq(422)
expect(response).to have_http_status(:unprocessable_entity)
expect(parsed['errors'][0]['detail']).to eq("Unable to locate Veteran's BIRLS ID in Master Person Index " \
'(MPI). ' \
'Please submit an issue at ask.va.gov or call 1-800-MyVA411 ' \
Expand Down
Loading

0 comments on commit a112804

Please sign in to comment.