From a11280461a1c35109b6b6c1588ff5dee6964d864 Mon Sep 17 00:00:00 2001 From: stevenjcumming <134282106+stevenjcumming@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:44:49 -0400 Subject: [PATCH] Reorganize ClaimsApi Request Specs (#18216) * 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 <161746194+pennja@users.noreply.github.com> * remove extra method * Fix stamping date * lint * booleans are hard * tests --------- Co-authored-by: Jacob Penner <161746194+pennja@users.noreply.github.com> * [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 * Mobile: Deprecate healthcare_service (#18085) * Deprecate healthcare_service * Rubocop --------- Co-authored-by: Tonksthebear * 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 <67602137+asg5704@users.noreply.github.com> * 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 <25069483+stiehlrod@users.noreply.github.com> * 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](https://github.com/tj-actions/changed-files/compare/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] 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 * 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](https://github.com/rubocop/rubocop-rails/compare/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] * 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eric Boehs * 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] Co-authored-by: Austin Covrig Co-authored-by: Austin Covrig Co-authored-by: Mitch Saltykov Co-authored-by: Tyler Co-authored-by: Jason C Co-authored-by: Tonksthebear Co-authored-by: Don Shin <99479640+cloudmagic80@users.noreply.github.com> Co-authored-by: Tai Wilkin-Corraggio Co-authored-by: John Luo Co-authored-by: Bryan Alexander Co-authored-by: Caitlin <78328496+CaitHawk@users.noreply.github.com> Co-authored-by: Alexander Garcia <67602137+asg5704@users.noreply.github.com> Co-authored-by: Rockwell Windsor Rice <129893414+rockwellwindsor-va@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: asiisii <36644181+asiisii@users.noreply.github.com> Co-authored-by: Khoa Nguyen <134089461+Khoa-V-Nguyen@users.noreply.github.com> Co-authored-by: khoa-v-nguyen Co-authored-by: Tom Harrison Co-authored-by: Eric Boehs Co-authored-by: Michael Clement Co-authored-by: dfong-adh <151783381+dfong-adh@users.noreply.github.com> Co-authored-by: Rachal Cassity Co-authored-by: Eric Tillberg * 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 * Mobile: Deprecate healthcare_service (#18085) * Deprecate healthcare_service * Rubocop --------- Co-authored-by: Tonksthebear * 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 <67602137+asg5704@users.noreply.github.com> * 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 <25069483+stiehlrod@users.noreply.github.com> * 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](https://github.com/tj-actions/changed-files/compare/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] 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 * 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](https://github.com/rubocop/rubocop-rails/compare/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] * 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eric Boehs * 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] Co-authored-by: Austin Covrig Co-authored-by: Austin Covrig Co-authored-by: Mitch Saltykov Co-authored-by: Tyler Co-authored-by: Jason C Co-authored-by: Tonksthebear Co-authored-by: Don Shin <99479640+cloudmagic80@users.noreply.github.com> Co-authored-by: Tai Wilkin-Corraggio Co-authored-by: John Luo Co-authored-by: Bryan Alexander Co-authored-by: Caitlin <78328496+CaitHawk@users.noreply.github.com> Co-authored-by: Alexander Garcia <67602137+asg5704@users.noreply.github.com> Co-authored-by: Rockwell Windsor Rice <129893414+rockwellwindsor-va@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: asiisii <36644181+asiisii@users.noreply.github.com> Co-authored-by: Khoa Nguyen <134089461+Khoa-V-Nguyen@users.noreply.github.com> Co-authored-by: khoa-v-nguyen Co-authored-by: Tom Harrison Co-authored-by: Eric Boehs Co-authored-by: Michael Clement Co-authored-by: dfong-adh <151783381+dfong-adh@users.noreply.github.com> Co-authored-by: Rachal Cassity Co-authored-by: Eric Tillberg * 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 * 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] Co-authored-by: Eric Tillberg Co-authored-by: Jacob Penner <161746194+pennja@users.noreply.github.com> Co-authored-by: Sam Stuckey Co-authored-by: Austin Covrig Co-authored-by: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com> Co-authored-by: Austin Covrig Co-authored-by: Mitch Saltykov Co-authored-by: Tyler Co-authored-by: Jason C Co-authored-by: Tonksthebear Co-authored-by: Don Shin <99479640+cloudmagic80@users.noreply.github.com> Co-authored-by: Tai Wilkin-Corraggio Co-authored-by: John Luo Co-authored-by: Bryan Alexander Co-authored-by: Caitlin <78328496+CaitHawk@users.noreply.github.com> Co-authored-by: Alexander Garcia <67602137+asg5704@users.noreply.github.com> Co-authored-by: Rockwell Windsor Rice <129893414+rockwellwindsor-va@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: asiisii <36644181+asiisii@users.noreply.github.com> Co-authored-by: Khoa Nguyen <134089461+Khoa-V-Nguyen@users.noreply.github.com> Co-authored-by: khoa-v-nguyen Co-authored-by: Tom Harrison Co-authored-by: Eric Boehs Co-authored-by: Michael Clement Co-authored-by: dfong-adh <151783381+dfong-adh@users.noreply.github.com> Co-authored-by: Rachal Cassity Co-authored-by: samcoforma <105806934+samcoforma@users.noreply.github.com> Co-authored-by: Ryan McNeil --- .../v1/api_spec.rb} | 2 +- ...adata_request_spec.rb => metadata_spec.rb} | 2 +- ...{claims_request_spec.rb => claims_spec.rb} | 28 +- .../0966_spec.rb} | 58 +-- .../2122_spec.rb} | 76 ++-- .../526_spec.rb} | 388 +++++++++--------- .../rswag_0966_spec.rb} | 50 +-- .../rswag_2122_spec.rb} | 102 ++--- .../rswag_526_spec.rb} | 88 ++-- ...s_request_spec.rb => rswag_claims_spec.rb} | 22 +- .../decisions/create/request_spec.rb | 2 +- .../index/request_spec.rb | 2 +- ...ec.rb => rswag_veteran_identifier_spec.rb} | 16 +- ...est_spec.rb => veteran_identifier_spec.rb} | 32 +- ...mpensation_request_spec.rb => 526_spec.rb} | 2 +- .../5103_spec.rb} | 14 +- ...{claims_request_spec.rb => claims_spec.rb} | 130 +++--- ...equest_spec.rb => intent_to_files_spec.rb} | 90 ++-- .../2122_spec.rb} | 4 +- .../2122a_spec.rb} | 4 +- .../power_of_attorney_request_spec.rb} | 4 +- .../power_of_attorney_spec.rb} | 9 +- ...ence_waiver_spec.rb => rswag_5103_spec.rb} | 22 +- ...tion_request_spec.rb => rswag_526_spec.rb} | 0 ...s_request_spec.rb => rswag_claims_spec.rb} | 36 +- 25 files changed, 582 insertions(+), 601 deletions(-) rename modules/claims_api/spec/requests/{v1/api_docs_request_spec.rb => docs/v1/api_spec.rb} (78%) rename modules/claims_api/spec/requests/{metadata_request_spec.rb => metadata_spec.rb} (98%) rename modules/claims_api/spec/requests/v1/{claims_request_spec.rb => claims_spec.rb} (94%) rename modules/claims_api/spec/requests/v1/{intent_to_file_request_spec.rb => forms/0966_spec.rb} (88%) rename modules/claims_api/spec/requests/v1/{power_of_attorney_request_spec.rb => forms/2122_spec.rb} (91%) rename modules/claims_api/spec/requests/v1/{disability_compensation_request_spec.rb => forms/526_spec.rb} (89%) rename modules/claims_api/spec/requests/v1/{rswag_intent_to_file_request_spec.rb => forms/rswag_0966_spec.rb} (86%) rename modules/claims_api/spec/requests/v1/{rswag_power_of_attorney_request_spec.rb => forms/rswag_2122_spec.rb} (85%) rename modules/claims_api/spec/requests/v1/{rswag_disability_compensation_request_spec.rb => forms/rswag_526_spec.rb} (86%) rename modules/claims_api/spec/requests/v1/{rswag_claims_request_spec.rb => rswag_claims_spec.rb} (88%) rename modules/claims_api/spec/requests/v2/{rswag_veteran_identifier_request_spec.rb => rswag_veteran_identifier_spec.rb} (89%) rename modules/claims_api/spec/requests/v2/{veteran_identifier_request_spec.rb => veteran_identifier_spec.rb} (85%) rename modules/claims_api/spec/requests/v2/veterans/{disability_compensation_request_spec.rb => 526_spec.rb} (99%) rename modules/claims_api/spec/requests/v2/veterans/{evidence_waiver_request_spec.rb => claims/5103_spec.rb} (96%) rename modules/claims_api/spec/requests/v2/veterans/{claims_request_spec.rb => claims_spec.rb} (94%) rename modules/claims_api/spec/requests/v2/veterans/{intent_to_files_request_spec.rb => intent_to_files_spec.rb} (88%) rename modules/claims_api/spec/requests/v2/veterans/{power_of_attorney_org_request_spec.rb => power_of_attorney/2122_spec.rb} (99%) rename modules/claims_api/spec/requests/v2/veterans/{power_of_attorney_ind_request_spec.rb => power_of_attorney/2122a_spec.rb} (99%) rename modules/claims_api/spec/requests/v2/veterans/{power_of_attorney_new_poa_request_spec.rb => power_of_attorney/power_of_attorney_request_spec.rb} (98%) rename modules/claims_api/spec/requests/v2/veterans/{power_of_attorney_request_spec.rb => power_of_attorney/power_of_attorney_spec.rb} (95%) rename modules/claims_api/spec/requests/v2/veterans/{rswag_evidence_waiver_spec.rb => rswag_5103_spec.rb} (86%) rename modules/claims_api/spec/requests/v2/veterans/{rswag_disability_compensation_request_spec.rb => rswag_526_spec.rb} (100%) rename modules/claims_api/spec/requests/v2/veterans/{rswag_claims_request_spec.rb => rswag_claims_spec.rb} (85%) diff --git a/modules/claims_api/spec/requests/v1/api_docs_request_spec.rb b/modules/claims_api/spec/requests/docs/v1/api_spec.rb similarity index 78% rename from modules/claims_api/spec/requests/v1/api_docs_request_spec.rb rename to modules/claims_api/spec/requests/docs/v1/api_spec.rb index b51a3b38743..e08ffa23f81 100644 --- a/modules/claims_api/spec/requests/v1/api_docs_request_spec.rb +++ b/modules/claims_api/spec/requests/docs/v1/api_spec.rb @@ -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' diff --git a/modules/claims_api/spec/requests/metadata_request_spec.rb b/modules/claims_api/spec/requests/metadata_spec.rb similarity index 98% rename from modules/claims_api/spec/requests/metadata_request_spec.rb rename to modules/claims_api/spec/requests/metadata_spec.rb index 2698b60a24a..adc35057982 100644 --- a/modules/claims_api/spec/requests/metadata_request_spec.rb +++ b/modules/claims_api/spec/requests/metadata_spec.rb @@ -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' diff --git a/modules/claims_api/spec/requests/v1/claims_request_spec.rb b/modules/claims_api/spec/requests/v1/claims_spec.rb similarity index 94% rename from modules/claims_api/spec/requests/v1/claims_request_spec.rb rename to modules/claims_api/spec/requests/v1/claims_spec.rb index 433e24fca21..88e036251f6 100644 --- a/modules/claims_api/spec/requests/v1/claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/claims_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 ' \ @@ -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 ' \ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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') diff --git a/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/0966_spec.rb similarity index 88% rename from modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/0966_spec.rb index 3a1c3590cd4..132f648802e 100644 --- a/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/0966_spec.rb @@ -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', @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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' @@ -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({}) @@ -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( @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -344,7 +344,7 @@ 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 @@ -352,7 +352,7 @@ 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 @@ -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 ' \ diff --git a/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/2122_spec.rb similarity index 91% rename from modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/2122_spec.rb index eb0cd459778..703db63e1b3 100644 --- a/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/2122_spec.rb @@ -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 'Power of Attorney ', type: :request do +RSpec.describe 'ClaimsApi::V1::Forms::2122', type: :request do let(:headers) do { 'X-VA-SSN': '796-04-3735', 'X-VA-First-Name': 'WESLEY', @@ -27,9 +27,9 @@ end describe '#2122' do - let(:data) { File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) } + let(:data) { Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read } let(:path) { '/services/claims/v1/forms/2122' } - let(:schema) { File.read(Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '2122.json')) } + let(:schema) { Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '2122.json').read } describe 'schema' do it 'returns a successful get response with json schema' do @@ -111,7 +111,7 @@ it 'returns an unprocessible entity status' do mock_acg(scopes) do |auth_header| post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -125,7 +125,7 @@ post path, params: data, headers: auth_header response_body = JSON.parse response.body - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(response_body['errors'][0]['detail']).to eq( "Unable to locate Veteran's Participant ID in Master Person Index (MPI). " \ 'Please submit an issue at ask.va.gov or call 1-800-MyVA411 (800-698-2411) for assistance.' @@ -153,7 +153,7 @@ allow(bgs_poa_verifier).to receive(:current_poa_code) .and_return(Struct.new(:code).new('HelloWorld')) post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -170,7 +170,7 @@ allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) allow(bgs_poa_verifier).to receive(:current_poa_code).and_return(Struct.new(:code).new('HelloWorld')) params = JSON.parse data - base64_signature = File.read(::Rails.root.join( + base64_signature = File.read(Rails.root.join( *'/modules/claims_api/spec/fixtures/signature_b64.txt'.split('/') ).to_s) signatures = { veteran: base64_signature, representative: base64_signature } @@ -205,13 +205,13 @@ it 'responds with a 422' do mock_acg(scopes) do |auth_header| - allow(::Veteran::Service::Representative).to receive(:all_for_user).and_return([]) + allow(Veteran::Service::Representative).to receive(:all_for_user).and_return([]) allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).and_return(nil) post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) error_detail = JSON.parse(response.body)['errors'][0]['detail'] substring = 'Veterans making requests do not need to include identifying headers' expect(error_detail.include?(substring)).to be true @@ -225,7 +225,7 @@ allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).and_return(nil) post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -237,7 +237,7 @@ allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).and_return(nil) post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -253,7 +253,7 @@ .and_raise(ArgumentError) mock_acg(scopes) do |auth_header| post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -269,13 +269,13 @@ it 'responds with invalid birth_date' do mock_acg(scopes) do |auth_header| - allow(::Veteran::Service::Representative).to receive(:all_for_user).and_return([]) + allow(Veteran::Service::Representative).to receive(:all_for_user).and_return([]) allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).and_return(nil) post path, params: data, headers: invalid_headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) error_detail = JSON.parse(response.body)['errors'][0]['detail'] substring = 'The following values are invalid: X-VA-Birth-Date' expect(error_detail).to eq(substring) @@ -294,13 +294,13 @@ it 'responds with invalid birth_date' do mock_acg(scopes) do |auth_header| - allow(::Veteran::Service::Representative).to receive(:all_for_user).and_return([]) + allow(Veteran::Service::Representative).to receive(:all_for_user).and_return([]) allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).and_return(nil) post path, params: data, headers: invalid_headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) error_detail = JSON.parse(response.body)['errors'][0]['detail'] substring = 'The following values are invalid: X-VA-First-Name, X-VA-Last-Name' expect(error_detail).to eq(substring) @@ -319,7 +319,7 @@ params = json_data params['data']['attributes']['serviceOrganization']['poaCode'] = nil post path, params: params.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) end end @@ -331,7 +331,7 @@ params = json_data params['data']['attributes']['someBadField'] = 'someValue' post path, params: params.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' @@ -369,7 +369,7 @@ params = JSON.parse data params['data']['attributes']['veteran'] = vetdata post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -392,12 +392,12 @@ describe '#upload' do let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:binary_params) do - { attachment: Rack::Test::UploadedFile.new(::Rails.root.join( + { attachment: Rack::Test::UploadedFile.new(Rails.root.join( *'/modules/claims_api/spec/fixtures/extras.pdf'.split('/') ).to_s) } end let(:base64_params) do - { attachment: File.read(::Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s) } + { attachment: File.read(Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s) } end it 'submit binary and change the document status' do @@ -444,7 +444,7 @@ allow_any_instance_of(ClaimsApi::V1::Forms::PowerOfAttorneyController) .to receive(:check_request_ssn_matches_mpi).with('987654321') parsed = JSON.parse(response.body) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(parsed['errors'].first['title']).to eq('Unprocessable Entity') end end @@ -465,7 +465,7 @@ power_of_attorney.reload parsed = JSON.parse(response.body) expect(power_of_attorney.file_data).to be_nil - expect(response.status).to eq(424) + expect(response).to have_http_status(:failed_dependency) expect(parsed['errors'].first['title']).to eq('Failed Dependency') expect(parsed['errors'].first['detail']).to eq('Failure occurred in a system dependency') end @@ -491,7 +491,7 @@ power_of_attorney.reload parsed = JSON.parse(response.body) expect(power_of_attorney.file_data).to be_nil - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(parsed['errors'].first['title']).to eq('Unprocessable Entity') expect(parsed['errors'].first['detail']).to eq(error_detail) end @@ -511,7 +511,7 @@ power_of_attorney.reload parsed = JSON.parse(response.body) expect(power_of_attorney.file_data).to be_nil - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(parsed['errors'].first['title']).to eq('Unprocessable Entity') expect(parsed['errors'].first['detail']).to eq(error_detail) end @@ -531,7 +531,7 @@ power_of_attorney.reload parsed = JSON.parse(response.body) expect(power_of_attorney.file_data).to be_nil - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(parsed['errors'].first['title']).to eq('Unprocessable Entity') expect(parsed['errors'].first['detail']).to eq(error_detail) end @@ -548,7 +548,7 @@ allow_any_instance_of(pws) .to receive(:find_by_ssn).and_return({ file_nbr: '123456789' }) put("#{path}/#{power_of_attorney.id}", headers: headers.merge(auth_header)) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) expect(response.parsed_body['errors'][0]['title']).to eq('Missing parameter') expect(response.parsed_body['errors'][0]['detail']).to eq('Must include attachment') end @@ -604,7 +604,7 @@ allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return(nil).once get("#{path}/active", params: nil, headers: headers.merge(auth_header)) - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -633,7 +633,7 @@ get("#{path}/active", params: nil, headers: headers.merge(auth_header)) parsed = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(parsed['data']['attributes']['representative']['service_organization']['poa_code']) .to eq('HelloWorld') end @@ -644,7 +644,7 @@ it 'returns a 403' do mock_acg(scopes) do |auth_header| get("#{path}/active", params: nil, headers: headers.merge(auth_header)) - expect(response.status).to eq(403) + expect(response).to have_http_status(:forbidden) end end end @@ -664,7 +664,7 @@ allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return('HelloWorld').exactly(3).times expect(bgs_poa_verifier).to receive(:previous_poa_code).and_return(nil) - expect(::Veteran::Service::Organization).to receive(:find_by).and_return( + expect(Veteran::Service::Organization).to receive(:find_by).and_return( OpenStruct.new(name: 'Some Great Organization', phone: '555-555-5555') ).twice @@ -672,7 +672,7 @@ parsed = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(parsed['data']['attributes']['representative']['service_organization']['organization_name']) .to eq('Some Great Organization') expect(parsed['data']['attributes']['representative']['service_organization']['first_name']) @@ -694,7 +694,7 @@ allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return('HelloWorld').exactly(3).times expect(bgs_poa_verifier).to receive(:previous_poa_code).and_return(nil) - allow(::Veteran::Service::Representative).to receive(:where).and_return( + allow(Veteran::Service::Representative).to receive(:where).and_return( [ OpenStruct.new( first_name: 'Tommy', @@ -708,7 +708,7 @@ parsed = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(parsed['data']['attributes']['representative']['service_organization']['first_name']) .to eq('Tommy') expect(parsed['data']['attributes']['representative']['service_organization']['last_name']) @@ -729,12 +729,12 @@ ).to receive(:validate_user_is_accredited!).and_return(nil) allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return('HelloWorld').twice - allow(::Veteran::Service::Organization).to receive(:find_by).and_return(nil) - allow(::Veteran::Service::Representative).to receive(:where).and_return([]) + allow(Veteran::Service::Organization).to receive(:find_by).and_return(nil) + allow(Veteran::Service::Representative).to receive(:where).and_return([]) get("#{path}/active", params: nil, headers: headers.merge(auth_header)) - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end diff --git a/modules/claims_api/spec/requests/v1/disability_compensation_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/526_spec.rb similarity index 89% rename from modules/claims_api/spec/requests/v1/disability_compensation_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/526_spec.rb index 2a4e66b5230..14fcffced46 100644 --- a/modules/claims_api/spec/requests/v1/disability_compensation_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/526_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../rails_helper' +require_relative '../../../rails_helper' -RSpec.describe 'Disability Claims ', type: :request do +RSpec.describe 'ClaimsApi::V1::Forms::526', type: :request do let(:headers) do { 'X-VA-SSN': '796-04-3735', 'X-VA-First-Name': 'WESLEY', @@ -34,7 +34,7 @@ let(:claim_date) { (Time.zone.today - 1.day).to_s } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled temp['data']['attributes']['claimDate'] = claim_date @@ -43,7 +43,7 @@ temp.to_json end let(:path) { '/services/claims/v1/forms/526' } - let(:schema) { File.read(Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '526.json')) } + let(:schema) { Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '526.json').read } let(:parsed_codes) do { birls_id: '111985523', @@ -79,7 +79,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -96,7 +96,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -113,7 +113,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -142,7 +142,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -177,7 +177,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -194,7 +194,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -225,7 +225,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -259,7 +259,7 @@ params['data']['attributes']['treatments'][0][:center][:country] = '' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -278,7 +278,7 @@ 'Here\'s a country that has a very very very long name' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -294,7 +294,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -313,7 +313,7 @@ post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -330,7 +330,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -348,7 +348,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -366,7 +366,7 @@ params = json_data params['data']['attributes']['treatments'] = treatments post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -416,7 +416,7 @@ context 'when autoCestPDFGenerationDisabled is true' do let(:auto_cest_pdf_generation_disabled) { true } - it 'creates the sidekick job' do + it 'creates the sidekick job', skip: 'No expectation in this example' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -501,7 +501,7 @@ mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do - auth_header_stub = instance_double('EVSS::DisabilityCompensationAuthHeaders') + auth_header_stub = instance_double(EVSS::DisabilityCompensationAuthHeaders) expect(EVSS::DisabilityCompensationAuthHeaders).to(receive(:new).once { auth_header_stub }) expect(auth_header_stub).to receive(:add_headers).once post path, params: data, headers: headers.merge(auth_header) @@ -520,8 +520,8 @@ let(:json_data) { JSON.parse data } let(:change_of_address) do { - beginningDate: (Time.zone.now - 1.month).to_date.to_s, - endingDate: (Time.zone.now + 1.month).to_date.to_s, + beginningDate: 1.month.ago.to_date.to_s, + endingDate: 1.month.from_now.to_date.to_s, addressChangeType: value, addressLine1: '1234 Couch Street', city: 'New York City', @@ -540,7 +540,7 @@ par['data']['attributes']['veteran']['changeOfAddress'] = change_of_address post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -552,7 +552,7 @@ context 'when an invalid country is submitted' do let(:change_of_address) do { - beginningDate: (Time.zone.now + 1.month).to_date.to_s, + beginningDate: 1.month.from_now.to_date.to_s, addressChangeType: 'PERMANENT', addressLine1: '1234 Couch Street', city: 'New York City', @@ -571,7 +571,7 @@ par['data']['attributes']['veteran']['changeOfAddress'] = change_of_address post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -582,12 +582,12 @@ # lines 89-92 in disability_compensation_validations.rb checks phone number for dash context 'when reservesNationalGuardService information is submitted' do let(:json_data) { JSON.parse data } - let(:title10_activation_date) { (Time.zone.now - 1.day).to_date.to_s } - let(:anticipated_separation_date) { (Time.zone.now + 1.year).to_date.to_s } + let(:title10_activation_date) { 1.day.ago.to_date.to_s } + let(:anticipated_separation_date) { 1.year.from_now.to_date.to_s } let(:reserves_national_guard_service) do { - obligationTermOfServiceFromDate: (Time.zone.now - 1.year).to_date.to_s, - obligationTermOfServiceToDate: (Time.zone.now - 6.months).to_date.to_s, + obligationTermOfServiceFromDate: 1.year.ago.to_date.to_s, + obligationTermOfServiceToDate: 6.months.ago.to_date.to_s, unitName: 'best-name-ever', unitPhone: { areaCode: '555', @@ -614,7 +614,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -632,7 +632,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -650,7 +650,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -669,7 +669,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -677,7 +677,7 @@ end context 'when title10ActivationDate is tomorrow' do - let(:title10_activation_date) { (Time.zone.now + 1.day).to_date.to_s } + let(:title10_activation_date) { 1.day.from_now.to_date.to_s } it 'raises an exception that title10ActivationDate is invalid' do mock_acg(scopes) do |auth_header| @@ -687,7 +687,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -696,7 +696,7 @@ context "'anticipatedSeparationDate' validations" do context "when 'anticipatedSeparationDate' is in the past" do - let(:anticipated_separation_date) { (Time.zone.now - 1.day).to_date.to_s } + let(:anticipated_separation_date) { 1.day.ago.to_date.to_s } it "raises an exception that 'anticipatedSeparationDate' is invalid" do mock_acg(scopes) do |auth_header| @@ -707,7 +707,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -715,7 +715,7 @@ end context "when 'anticipatedSeparationDate' is today" do - let(:anticipated_separation_date) { (Time.zone.now - 1.hour).to_date.to_s } + let(:anticipated_separation_date) { 1.hour.ago.to_date.to_s } it "raises an exception that 'anticipatedSeparationDate' is invalid" do mock_acg(scopes) do |auth_header| @@ -725,14 +725,14 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end end context "when 'anticipatedSeparationDate' is in the future" do - let(:anticipated_separation_date) { (Time.zone.now + 1.day).to_date.to_s } + let(:anticipated_separation_date) { 1.day.from_now.to_date.to_s } it 'returns a successful response' do mock_acg(scopes) do |auth_header| @@ -743,7 +743,7 @@ reserves_national_guard_service post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -764,7 +764,7 @@ post path, params: params.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(2) expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( 'The property /serviceInformation/someBadField is not defined on the schema. Additional properties are not allowed' @@ -781,7 +781,7 @@ params = json_data params['data']['attributes']['veteran']['currentMailingAddress'] = {} post path, params: params.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(5) end end @@ -794,7 +794,7 @@ par['data']['attributes']['veteran']['homelessness']['pointOfContact']['primaryPhone']['phoneNumber'] = '555-5555' post path, params: par.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -817,7 +817,7 @@ } } post path, params: par.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) end end @@ -840,7 +840,7 @@ } } post path, params: par.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) end end @@ -851,7 +851,7 @@ params = json_data params['data']['attributes']['disabilities'] = [{}] post path, params: params.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(4) end end @@ -863,7 +863,7 @@ params = json_data params['data']['attributes']['disabilities'][0]['specialIssues'] = ['invalidType'] post path, params: params.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) end end @@ -877,7 +877,7 @@ params = json_data params['data']['attributes']['disabilities'][0]['specialIssues'] = %w[ALS PTSD/1] post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -892,7 +892,7 @@ params = json_data params['data']['attributes']['veteran']['flashes'] = ['invalidType'] post path, params: params.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) end end @@ -906,7 +906,7 @@ params = json_data params['data']['attributes']['veteran']['flashes'] = %w[Hardship POW] post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -922,7 +922,7 @@ params['data']['attributes']['veteran']['currentMailingAddress'] = mailing_address post path, params: params.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) end end @@ -940,7 +940,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, 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']).to be_an Array end end @@ -960,7 +960,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) body = JSON.parse(response.body) - expect(response.status).to eq 422 + expect(response).to have_http_status :unprocessable_entity expect(body['errors']).to be_an Array expect(body.dig('errors', 0, 'detail')).to eq "The request body isn't a JSON object: #{json}" end @@ -976,7 +976,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) body = JSON.parse(response.body) - expect(response.status).to eq 422 + expect(response).to have_http_status :unprocessable_entity expect(body['errors']).to be_an Array expect(body.dig('errors', 0, 'detail')).to eq "The request body isn't a JSON object: #{json}" end @@ -1034,7 +1034,7 @@ def obj.class params['data']['attributes']['veteran']['currentMailingAddress'] = {} post path, params: params.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'].size).to eq(5) end end @@ -1042,7 +1042,7 @@ def obj.class context 'Timeouts are recorded (investigating)' do [Common::Exceptions::GatewayTimeout, Timeout::Error, Faraday::TimeoutError].each do |error_klass| context error_klass.to_s do - it 'is logged to PersonalInformationLog' do + it 'is logged to PersonalInformationLog', skip: 'No expectation in this example' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do VCR.use_cassette('claims_api/bgs/claims/claims') do @@ -1107,7 +1107,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1144,7 +1144,7 @@ def obj.class post path, params: data, headers: auth_header - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1163,7 +1163,7 @@ def obj.class .and_return(profile_with_edipi) post path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1190,7 +1190,7 @@ def obj.class post path, params: data, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(json_response['errors'][0]['detail']).to eq( "Unable to locate Veteran's Participant ID in Master Person Index (MPI). " \ 'Please submit an issue at ask.va.gov or call 1-800-MyVA411 (800-698-2411) for assistance.' @@ -1212,7 +1212,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1237,7 +1237,7 @@ def obj.class post path, params: data, headers: headers.merge(auth_header) data = JSON.parse(response.body) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) expect(data['errors'][0]['detail']).to eq( 'Veteran has multiple active Participant IDs in Master Person Index (MPI). ' \ 'Please submit an issue at ask.va.gov or call 1-800-MyVA411 (800-698-2411) for assistance.' @@ -1267,7 +1267,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1282,7 +1282,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1296,7 +1296,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1320,7 +1320,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1335,7 +1335,7 @@ def obj.class VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1349,21 +1349,21 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end end context "and 'claim_date' has timezone (iso w/Z)" do - let(:claim_date) { (Time.zone.now - 1.day).iso8601 } + let(:claim_date) { 1.day.ago.iso8601 } it 'responds with a 200' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1371,14 +1371,14 @@ def obj.class end context "and 'claim_date' has timezone (iso wo/Z)" do - let(:claim_date) { (Time.zone.now - 1.day).iso8601.sub('Z', '-00:00') } + let(:claim_date) { 1.day.ago.iso8601.sub('Z', '-00:00') } it 'responds with a 200' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1386,39 +1386,39 @@ def obj.class end context "and 'claim_date' has timezone (iso w/out zone)" do - let(:claim_date) { (Time.zone.now - 1.day).iso8601.sub('Z', '') } + let(:claim_date) { 1.day.ago.iso8601.sub('Z', '') } it 'responds with a bad request' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end end context "and 'claim_date' has timezone (TZ String)" do - let(:claim_date) { (Time.zone.now - 1.day).to_s } + let(:claim_date) { 1.day.ago.to_s } it 'responds with a 422' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end end context "and 'claim_date' has timezone (w/out T)" do - let(:claim_date) { (Time.zone.now - 1.day).iso8601.sub('T', ' ') } + let(:claim_date) { 1.day.ago.iso8601.sub('T', ' ') } it 'responds with a 422' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1431,7 +1431,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1444,7 +1444,7 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do post path, params: data, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1460,7 +1460,7 @@ def obj.class params = json_data params['data']['attributes']['applicationExpirationDate'] = (Time.zone.today - 1.day).to_s post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1474,7 +1474,7 @@ def obj.class params = json_data params['data']['attributes']['applicationExpirationDate'] = Time.zone.today.to_s post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1489,7 +1489,7 @@ def obj.class params = json_data params['data']['attributes']['applicationExpirationDate'] = (Time.zone.today + 1.day).to_s post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1504,7 +1504,7 @@ def obj.class params = json_data params['data']['attributes']['claimantCertification'] = false post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1521,7 +1521,7 @@ def obj.class (Time.zone.today + 10.days).to_s post path, params: params.to_json, headers: headers.merge(auth_header) json = JSON.parse(response.body) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) expect(json['errors'][0]['title']).to eq('Invalid field value') end end @@ -1540,7 +1540,7 @@ def obj.class params['data']['attributes']['serviceInformation']['servicePeriods'].first['separationLocationCode'] = '11111111111' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1559,7 +1559,7 @@ def obj.class }] post path, params: params.to_json, headers: headers.merge(auth_header) response_error_details = JSON.parse(response.body)['errors'].first['detail'] - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) expect(response_error_details).to include('confinements must be within a service period') end end @@ -1583,7 +1583,7 @@ def obj.class }] post path, params: params.to_json, headers: headers.merge(auth_header) response_error_details = JSON.parse(response.body)['errors'].first['detail'] - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) expect(response_error_details).to include('confinements must not overlap other confinements') end end @@ -1605,11 +1605,11 @@ def obj.class otherLivingSituation: 'community help center' } post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) response_body = JSON.parse(response.body) expect(response_body['errors'].length).to eq(1) expect(response_body['errors'][0]['detail']).to eq( - "Must define only one of 'veteran.homelessness.currentlyHomeless' or "\ + "Must define only one of 'veteran.homelessness.currentlyHomeless' or " \ "'veteran.homelessness.homelessnessRisk'" ) end @@ -1633,12 +1633,12 @@ def obj.class } } post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) response_body = JSON.parse(response.body) expect(response_body['errors'].length).to eq(1) expect(response_body['errors'][0]['detail']).to eq( - "If 'veteran.homelessness.pointOfContact' is defined, then one of "\ - "'veteran.homelessness.currentlyHomeless' or 'veteran.homelessness.homelessnessRisk'"\ + "If 'veteran.homelessness.pointOfContact' is defined, then one of " \ + "'veteran.homelessness.currentlyHomeless' or 'veteran.homelessness.homelessnessRisk'" \ ' is required' ) end @@ -1661,11 +1661,11 @@ def obj.class } params['data']['attributes']['veteran']['homelessness'].delete('pointOfContact') post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) response_body = JSON.parse(response.body) expect(response_body['errors'].length).to eq(1) expect(response_body['errors'][0]['detail']).to eq( - "If one of 'veteran.homelessness.currentlyHomeless' or 'veteran.homelessness.homelessnessRisk' is"\ + "If one of 'veteran.homelessness.currentlyHomeless' or 'veteran.homelessness.homelessnessRisk' is" \ " defined, then 'veteran.homelessness.pointOfContact' is required" ) end @@ -1680,12 +1680,12 @@ def obj.class describe "'receiving' and 'willReceiveInFuture' validations" do let(:service_pay_attribute) do { - 'militaryRetiredPay': { - 'receiving': receiving, - 'willReceiveInFuture': will_receive, - 'futurePayExplanation': 'Some explanation', - 'payment': { - 'serviceBranch': 'Air Force' + militaryRetiredPay: { + receiving:, + willReceiveInFuture: will_receive, + futurePayExplanation: 'Some explanation', + payment: { + serviceBranch: 'Air Force' } } } @@ -1704,7 +1704,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1722,7 +1722,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -1742,7 +1742,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1761,7 +1761,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1773,12 +1773,12 @@ def obj.class describe "'payment'" do let(:service_pay_attribute) do { - 'militaryRetiredPay': { - 'receiving': true, - 'willReceiveInFuture': false, - 'payment': { - 'serviceBranch': 'Air Force', - 'amount': military_retired_payment_amount + militaryRetiredPay: { + receiving: true, + willReceiveInFuture: false, + payment: { + serviceBranch: 'Air Force', + amount: military_retired_payment_amount } } } @@ -1794,7 +1794,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1811,7 +1811,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1829,7 +1829,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1844,11 +1844,11 @@ def obj.class context "when 'militaryRetiredPay.futurePayExplanation' is not provided" do let(:service_pay_attribute) do { - 'militaryRetiredPay': { - 'receiving': false, - 'willReceiveInFuture': will_receive_in_future, - 'payment': { - 'serviceBranch': 'Air Force' + militaryRetiredPay: { + receiving: false, + willReceiveInFuture: will_receive_in_future, + payment: { + serviceBranch: 'Air Force' } } } @@ -1861,7 +1861,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1870,12 +1870,12 @@ def obj.class context "when 'militaryRetiredPay.futurePayExplanation' is provided" do let(:service_pay_attribute) do { - 'militaryRetiredPay': { - 'receiving': false, - 'willReceiveInFuture': will_receive_in_future, - 'futurePayExplanation': 'Retiring soon.', - 'payment': { - 'serviceBranch': 'Air Force' + militaryRetiredPay: { + receiving: false, + willReceiveInFuture: will_receive_in_future, + futurePayExplanation: 'Retiring soon.', + payment: { + serviceBranch: 'Air Force' } } } @@ -1889,7 +1889,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1903,12 +1903,12 @@ def obj.class describe "'payment'" do let(:service_pay_attribute) do { - 'separationPay': { - 'received': true, - 'receivedDate': (Time.zone.today - 1.year).to_s, - 'payment': { - 'serviceBranch': 'Air Force', - 'amount': separation_payment_amount + separationPay: { + received: true, + receivedDate: (Time.zone.today - 1.year).to_s, + payment: { + serviceBranch: 'Air Force', + amount: separation_payment_amount } } } @@ -1924,7 +1924,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1941,7 +1941,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -1959,7 +1959,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1970,12 +1970,12 @@ def obj.class describe "'receivedDate'" do let(:service_pay_attribute) do { - 'separationPay': { - 'received': true, - 'receivedDate': received_date, - 'payment': { - 'serviceBranch': 'Air Force', - 'amount': 100 + separationPay: { + received: true, + receivedDate: received_date, + payment: { + serviceBranch: 'Air Force', + amount: 100 } } } @@ -1991,7 +1991,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2008,7 +2008,7 @@ def obj.class params = json_data params['data']['attributes']['servicePay'] = service_pay_attribute post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2033,7 +2033,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2061,7 +2061,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -2097,7 +2097,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2133,7 +2133,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2162,7 +2162,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2189,7 +2189,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2217,7 +2217,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2244,7 +2244,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2277,7 +2277,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2299,7 +2299,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2324,7 +2324,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -2348,7 +2348,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2370,7 +2370,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -2402,7 +2402,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -2428,7 +2428,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2458,7 +2458,7 @@ def obj.class params = json_data params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2482,7 +2482,7 @@ def obj.class ] params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2514,12 +2514,12 @@ def obj.class params = json_data params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end - it 'responds with a useful error message ' do + it 'responds with a useful error message' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do @@ -2547,7 +2547,7 @@ def obj.class params = json_data params['data']['attributes']['disabilities'] = disabilities post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2568,12 +2568,12 @@ def obj.class params['data']['attributes']['disabilities'] = disabilities params['data']['attributes']['serviceInformation'].delete('confinements') post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end - it 'responds with a useful error message ' do + it 'responds with a useful error message' do mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/brd/countries') do json_data = JSON.parse data @@ -2608,7 +2608,7 @@ def obj.class params['data']['attributes']['disabilities'] = disabilities params['data']['attributes']['serviceInformation']['confinements'] = confinements post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2693,7 +2693,7 @@ def obj.class params = json_data params['data']['attributes']['veteran']['currentMailingAddress']['addressLine3'] = 'Box 123' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2709,7 +2709,7 @@ def obj.class params = json_data params['data']['attributes']['veteran']['currentMailingAddress']['country'] = 'USA' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2722,7 +2722,7 @@ def obj.class params = json_data params['data']['attributes']['veteran']['currentMailingAddress']['country'] = 'US' post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -2740,7 +2740,7 @@ def obj.class params = json_data params['data']['attributes'].delete('applicationExpirationDate') post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -2755,8 +2755,8 @@ def obj.class mock_acg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/claims/claims') do VCR.use_cassette('claims_api/brd/countries') do - direct_deposit_info = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', - 'form_526_direct_deposit.json')) + direct_deposit_info = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', + 'form_526_direct_deposit.json').read json_data = JSON.parse data params = json_data params['data']['attributes']['directDeposit'] = JSON.parse direct_deposit_info @@ -2764,7 +2764,7 @@ def obj.class post path, params: params.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) response_body = JSON.parse response.body claim_id = response_body['data']['id'] claim = ClaimsApi::AutoEstablishedClaim.find(claim_id) @@ -2781,8 +2781,8 @@ def obj.class let(:claim_date) { (Time.zone.today - 1.day).to_s } let(:auto_cest_pdf_generation_disabled) { false } let(:data_no_flashes) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', - 'form_526_no_flashes_no_special_issues.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', + 'form_526_no_flashes_no_special_issues.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled temp['data']['attributes']['claimDate'] = claim_date @@ -2791,7 +2791,7 @@ def obj.class temp.to_json end let(:path) { '/services/claims/v1/forms/526' } - let(:schema) { File.read(Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '526.json')) } + let(:schema) { Rails.root.join('modules', 'claims_api', 'config', 'schemas', 'v1', '526.json').read } it 'sets the flashes and special_issues' do mock_acg(scopes) do |auth_header| @@ -2812,22 +2812,22 @@ def obj.class let(:auto_claim) { create(:auto_established_claim) } let(:non_auto_claim) { create(:auto_established_claim, :autoCestPDFGeneration_disabled) } let(:binary_params) do - { attachment1: Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf' + { attachment1: Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf' .split('/')).to_s), - attachment2: Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf' + attachment2: Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf' .split('/')).to_s) } end let(:base64_params) do - { attachment1: File.read(::Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s), - attachment2: File.read(::Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s) } + { attachment1: File.read(Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s), + attachment2: File.read(Rails.root.join(*'/modules/claims_api/spec/fixtures/base64pdf'.split('/')).to_s) } end context 'when no attachment is provided to the PUT endpoint' do it 'rejects the request for missing param' do mock_acg(scopes) do |auth_header| put("/services/claims/v1/forms/526/#{auto_claim.id}", headers: headers.merge(auth_header)) - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) expect(response.parsed_body['errors'][0]['title']).to eq('Missing parameter') expect(response.parsed_body['errors'][0]['detail']).to eq('Must include attachment') end @@ -2839,7 +2839,7 @@ def obj.class allow_any_instance_of(ClaimsApi::SupportingDocumentUploader).to receive(:store!) put("/services/claims/v1/forms/526/#{auto_claim.id}", params: binary_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) auto_claim.reload expect(auto_claim.file_data).to be_truthy end @@ -2850,7 +2850,7 @@ def obj.class allow_any_instance_of(ClaimsApi::SupportingDocumentUploader).to receive(:store!) put("/services/claims/v1/forms/526/#{auto_claim.id}", params: base64_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) auto_claim.reload expect(auto_claim.file_data).to be_truthy end @@ -2861,7 +2861,7 @@ def obj.class allow_any_instance_of(ClaimsApi::SupportingDocumentUploader).to receive(:store!) put("/services/claims/v1/forms/526/#{non_auto_claim.id}", params: binary_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end @@ -2871,7 +2871,7 @@ def obj.class count = auto_claim.supporting_documents.count post("/services/claims/v1/forms/526/#{auto_claim.id}/attachments", params: binary_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) auto_claim.reload expect(auto_claim.supporting_documents.count).to eq(count + 2) end @@ -2883,7 +2883,7 @@ def obj.class count = auto_claim.supporting_documents.count post("/services/claims/v1/forms/526/#{auto_claim.id}/attachments", params: base64_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) auto_claim.reload expect(auto_claim.supporting_documents.count).to eq(count + 2) end @@ -2895,7 +2895,7 @@ def obj.class allow_any_instance_of(ClaimsApi::SupportingDocumentUploader).to receive(:store!) post("/services/claims/v1/forms/526/#{bad_id}/attachments", params: binary_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end @@ -2919,7 +2919,7 @@ def obj.class count = auto_claim.supporting_documents.count post("/services/claims/v1/forms/526/#{auto_claim.id}/attachments", params: base64_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) auto_claim.reload expect(auto_claim.supporting_documents.count).to eq(count + 2) end @@ -2933,7 +2933,7 @@ def obj.class allow_any_instance_of(ClaimsApi::SupportingDocumentUploader).to receive(:store!) put("/services/claims/v1/forms/526/#{auto_claim.id}", params: binary_params, headers: headers.merge(auth_header)) - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -2943,7 +2943,7 @@ def obj.class let(:claim_date) { (Time.zone.today - 1.day).to_s } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled temp['data']['attributes']['claimDate'] = claim_date @@ -2959,7 +2959,7 @@ def obj.class VCR.use_cassette('claims_api/brd/countries') do json = JSON.parse(data) post path, params: json.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) first_submit_parsed = JSON.parse(response.body) @original_id = first_submit_parsed['data']['id'] end @@ -2970,7 +2970,7 @@ def obj.class VCR.use_cassette('claims_api/brd/countries') do json = JSON.parse(data) post path, params: json.to_json, headers: headers.merge(auth_header) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) duplicate_submit_parsed = JSON.parse(response.body) duplicate_id = duplicate_submit_parsed['data']['id'] expect(@original_id).to eq(duplicate_id) diff --git a/modules/claims_api/spec/requests/v1/rswag_intent_to_file_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/rswag_0966_spec.rb similarity index 86% rename from modules/claims_api/spec/requests/v1/rswag_intent_to_file_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/rswag_0966_spec.rb index 0703424421d..00d0dfb8722 100644 --- a/modules/claims_api/spec/requests/v1/rswag_intent_to_file_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/rswag_0966_spec.rb @@ -3,10 +3,10 @@ require 'swagger_helper' require Rails.root.join('spec', 'rswag_override.rb').to_s require 'rails_helper' -require_relative '../../rails_helper' -require_relative '../../support/swagger_shared_components/v1' +require_relative '../../../rails_helper' +require_relative '../../../support/swagger_shared_components/v1' -describe 'Intent to file', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do # rubocop:disable RSpec/DescribeClass +Rspec.describe 'Intent to file', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do path '/forms/0966' do get 'Get 0966 JSON Schema for form.' do deprecated true @@ -69,8 +69,8 @@ describe 'Getting a successful response' do response '200', '0966 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'intent_to_file', 'submission.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'intent_to_file', 'submission.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'compensation' } } } } @@ -101,8 +101,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'compensation' } } } } @@ -135,8 +135,8 @@ describe 'Getting a 403 response' do response '403', 'Forbidden' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'burial' } } } } @@ -170,8 +170,8 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'HelloWorld' } } } } @@ -236,8 +236,8 @@ describe 'Getting a 200 response' do response '200', '0966 response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'intent_to_file', 'active.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'intent_to_file', 'active.json').read) let(:scopes) { %w[claim.write] } let(:type) { 'compensation' } @@ -270,8 +270,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:type) { 'compensation' } @@ -304,8 +304,8 @@ describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:type) { 'compensation' } @@ -338,8 +338,8 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:type) { 'HelloWorld' } @@ -405,8 +405,8 @@ describe 'Getting a successful response' do response '200', '0966 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'intent_to_file', 'validate.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'intent_to_file', 'validate.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'compensation' } } } } @@ -437,8 +437,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: { type: 'compensation' } } } } @@ -471,8 +471,8 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.write] } let(:data) { { data: { attributes: nil } } } diff --git a/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/rswag_2122_spec.rb similarity index 85% rename from modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/rswag_2122_spec.rb index 9adcd0483e1..98352e2eca8 100644 --- a/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/rswag_2122_spec.rb @@ -3,10 +3,10 @@ require 'swagger_helper' require Rails.root.join('spec', 'rswag_override.rb').to_s require 'rails_helper' -require_relative '../../rails_helper' -require_relative '../../support/swagger_shared_components/v1' +require_relative '../../../rails_helper' +require_relative '../../../support/swagger_shared_components/v1' -describe 'Power of Attorney', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do # rubocop:disable RSpec/DescribeClass +Rspec.describe 'Power of Attorney', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do let(:pws) { ClaimsApi::LocalBGS } path '/forms/2122' do @@ -77,12 +77,12 @@ describe 'Getting a successful response' do response '200', '2122 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'power_of_attorney', 'submission.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'power_of_attorney', 'submission.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read temp = JSON.parse(temp) temp @@ -123,12 +123,12 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read temp = JSON.parse(temp) temp @@ -160,12 +160,12 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['serviceOrganization']['poaCode'] = nil @@ -247,13 +247,13 @@ describe 'Getting a successful response' do response '200', '2122 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'power_of_attorney', 'upload.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'power_of_attorney', 'upload.json').read) let(:scopes) { %w[claim.read claim.write] } let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { power_of_attorney.id } @@ -287,13 +287,13 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { power_of_attorney.id } @@ -329,12 +329,12 @@ describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { 999_999_999 } @@ -366,13 +366,13 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable Entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { power_of_attorney.id } @@ -403,13 +403,13 @@ describe 'Getting a 424 response' do response '424', 'Failed Dependency' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { power_of_attorney.id } @@ -442,8 +442,8 @@ describe 'Getting a 400 response' do response '400', 'Bad Request' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:power_of_attorney) { create(:power_of_attorney_without_doc) } let(:attachment) { nil } @@ -507,8 +507,8 @@ describe 'Getting a 200 response' do response '200', '2122 response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'power_of_attorney', 'get.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'power_of_attorney', 'get.json').read) let(:headers) do { 'X-VA-SSN': '796-04-3735', @@ -546,8 +546,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:headers) do { 'X-VA-SSN': '796-04-3735', @@ -587,8 +587,8 @@ describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:headers) do { 'X-VA-SSN': '796-04-3735', @@ -657,8 +657,8 @@ describe 'Getting a 200 response' do response '200', '2122 response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'power_of_attorney', 'active.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'power_of_attorney', 'active.json').read) let(:scopes) { %w[claim.read claim.write] } let(:bgs_poa_verifier) { BGS::PowerOfAttorneyVerifier.new(nil) } @@ -676,7 +676,7 @@ mock_acg(scopes) do allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) - allow(::Veteran::Service::Representative).to receive(:for_user).and_return(true) + allow(Veteran::Service::Representative).to receive(:for_user).and_return(true) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return('HelloWorld').exactly(3).times expect(bgs_poa_verifier).to receive(:previous_poa_code).and_return(nil) expect_any_instance_of( @@ -702,8 +702,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:Authorization) { nil } @@ -733,8 +733,8 @@ describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:bgs_poa_verifier) { BGS::PowerOfAttorneyVerifier.new(nil) } @@ -744,7 +744,7 @@ mock_acg(scopes) do allow(BGS::PowerOfAttorneyVerifier).to receive(:new).and_return(bgs_poa_verifier) - allow(::Veteran::Service::Representative).to receive(:for_user).and_return(true) + allow(Veteran::Service::Representative).to receive(:for_user).and_return(true) expect(bgs_poa_verifier).to receive(:current_poa_code).and_return(nil) submit_request(example.metadata) end @@ -800,12 +800,12 @@ describe 'Getting a successful response' do response '200', '2122 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'power_of_attorney', 'validate.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'power_of_attorney', 'validate.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read temp = JSON.parse(temp) temp @@ -841,12 +841,12 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_2122_json_api.json').read temp = JSON.parse(temp) temp @@ -878,8 +878,8 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.read claim.write] } let(:data) { { data: { attributes: nil } } } diff --git a/modules/claims_api/spec/requests/v1/rswag_disability_compensation_request_spec.rb b/modules/claims_api/spec/requests/v1/forms/rswag_526_spec.rb similarity index 86% rename from modules/claims_api/spec/requests/v1/rswag_disability_compensation_request_spec.rb rename to modules/claims_api/spec/requests/v1/forms/rswag_526_spec.rb index 1dd9d4aa6a5..d6b3b5dbb4f 100644 --- a/modules/claims_api/spec/requests/v1/rswag_disability_compensation_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/forms/rswag_526_spec.rb @@ -3,10 +3,10 @@ require 'swagger_helper' require Rails.root.join('spec', 'rswag_override.rb').to_s require 'rails_helper' -require_relative '../../rails_helper' -require_relative '../../support/swagger_shared_components/v1' +require_relative '../../../rails_helper' +require_relative '../../../support/swagger_shared_components/v1' -describe 'Disability Claims', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do # rubocop:disable RSpec/DescribeClass +Rspec.describe 'Disability Claims', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do path '/forms/526' do get 'Get a 526 schema for a claim.' do deprecated true @@ -87,13 +87,13 @@ describe 'Getting a successful response' do response '200', '526 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'disability', 'submission.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'disability', 'submission.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled temp['data']['attributes']['applicationExpirationDate'] = (Time.zone.today + 1.day).to_s @@ -129,13 +129,13 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled @@ -172,8 +172,8 @@ describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } @@ -202,7 +202,7 @@ def append_example_metadata(example, response) context 'Violates JSON Schema' do let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['someBadKey'] = 'someValue' @@ -293,13 +293,13 @@ def append_example_metadata(example, response) describe 'Getting a successful response' do response '200', '526 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'disability', 'upload.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'disability', 'upload.json').read) let(:scopes) { %w[claim.write] } let(:auto_claim) { create(:auto_established_claim) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { auto_claim.id } @@ -358,12 +358,12 @@ def append_example_metadata(example, response) describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { 999_999_999 } @@ -393,13 +393,13 @@ def append_example_metadata(example, response) describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:auto_claim) { create(:auto_established_claim) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { auto_claim.id } @@ -431,13 +431,13 @@ def append_example_metadata(example, response) describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:auto_claim) { create(:auto_established_claim, :autoCestPDFGeneration_disabled) } let(:attachment) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { auto_claim.id } @@ -502,13 +502,13 @@ def append_example_metadata(example, response) describe 'Getting a successful response' do response '200', '526 Response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'disability', 'validate.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'disability', 'validate.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled temp['data']['attributes']['applicationExpirationDate'] = (Time.zone.today + 1.day).to_s @@ -551,13 +551,13 @@ def append_example_metadata(example, response) describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } let(:data) do - temp = File.read(Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json')) + temp = Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'form_526_json_api.json').read temp = JSON.parse(temp) temp['data']['attributes']['autoCestPDFGenerationDisabled'] = auto_cest_pdf_generation_disabled @@ -594,8 +594,8 @@ def append_example_metadata(example, response) describe 'Getting a 422 response' do response '422', 'Unprocessable entity' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default_with_source.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default_with_source.json').read) let(:scopes) { %w[claim.write] } let(:auto_cest_pdf_generation_disabled) { false } @@ -682,17 +682,17 @@ def append_example_metadata(example, response) describe 'Getting a successful response' do response '200', 'upload response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', - 'disability', 'attachments.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'forms', + 'disability', 'attachments.json').read) let(:scopes) { %w[claim.write] } let(:auto_claim) { create(:auto_established_claim) } let(:attachment1) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:attachment2) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { auto_claim.id } @@ -722,17 +722,17 @@ def append_example_metadata(example, response) describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:auto_claim) { create(:auto_established_claim) } let(:attachment1) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:attachment2) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { auto_claim.id } @@ -764,16 +764,16 @@ def append_example_metadata(example, response) describe 'Getting a 404 response' do response '404', 'Resource not found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.write] } let(:attachment1) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:attachment2) do - Rack::Test::UploadedFile.new(::Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) + Rack::Test::UploadedFile.new(Rails.root.join(*'/modules/claims_api/spec/fixtures/extras.pdf'.split('/')) .to_s) end let(:id) { 999_999_999 } diff --git a/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb b/modules/claims_api/spec/requests/v1/rswag_claims_spec.rb similarity index 88% rename from modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb rename to modules/claims_api/spec/requests/v1/rswag_claims_spec.rb index 7d83b317786..4770b01afee 100644 --- a/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/rswag_claims_spec.rb @@ -6,7 +6,7 @@ require_relative '../../rails_helper' require_relative '../../support/swagger_shared_components/v1' -describe 'EVSS Claims management', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do # rubocop:disable RSpec/DescribeClass +Rspec.describe 'EVSS Claims management', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do path '/claims' do get 'Find all benefits claims for a Veteran' do tags 'Claims' @@ -54,7 +54,7 @@ describe 'Getting a 200 response' do response '200', 'claim response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'claims.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'claims.json').read) let(:scopes) { %w[claim.read] } @@ -86,8 +86,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read] } let(:Authorization) { nil } @@ -119,8 +119,8 @@ describe 'Getting a 404 response' do response '404', 'Resource Not Found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read] } @@ -189,7 +189,7 @@ describe 'Getting a 200 response' do response '200', 'claims response' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'claim.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'claim.json').read) let(:scopes) { %w[claim.read] } let(:claim) do @@ -223,8 +223,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read] } let(:id) { '600118851' } @@ -257,8 +257,8 @@ describe 'Getting a 404 response' do response '404', 'Record Not Found' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'errors', + 'default.json').read) let(:scopes) { %w[claim.read] } let(:id) { '999999999999999' } diff --git a/modules/claims_api/spec/requests/v2/power_of_attorney_requests/decisions/create/request_spec.rb b/modules/claims_api/spec/requests/v2/power_of_attorney_requests/decisions/create/request_spec.rb index ca9f1f3a5f8..d9420879bf5 100644 --- a/modules/claims_api/spec/requests/v2/power_of_attorney_requests/decisions/create/request_spec.rb +++ b/modules/claims_api/spec/requests/v2/power_of_attorney_requests/decisions/create/request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require Rails.root / 'modules/claims_api/spec/rails_helper' -RSpec.describe 'Power Of Attorney Requests: decisions#create', :bgs, type: :request do +RSpec.describe 'ClaimsApi::V2::PowerOfAttorneyRequests::Decisions#create', :bgs, type: :request do def perform_request(params) post( "/services/claims/v2/power-of-attorney-requests/#{id}/decision", diff --git a/modules/claims_api/spec/requests/v2/power_of_attorney_requests/index/request_spec.rb b/modules/claims_api/spec/requests/v2/power_of_attorney_requests/index/request_spec.rb index 68f88bcde93..23d1dc0f0e1 100644 --- a/modules/claims_api/spec/requests/v2/power_of_attorney_requests/index/request_spec.rb +++ b/modules/claims_api/spec/requests/v2/power_of_attorney_requests/index/request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require Rails.root / 'modules/claims_api/spec/rails_helper' -RSpec.describe 'Power Of Attorney Requests: index', :bgs, type: :request do +RSpec.describe 'ClaimsApi::V2::PowerOfAttorneyRequests#index', :bgs, type: :request do subject { perform_request(params) } def perform_request(params) diff --git a/modules/claims_api/spec/requests/v2/rswag_veteran_identifier_request_spec.rb b/modules/claims_api/spec/requests/v2/rswag_veteran_identifier_spec.rb similarity index 89% rename from modules/claims_api/spec/requests/v2/rswag_veteran_identifier_request_spec.rb rename to modules/claims_api/spec/requests/v2/rswag_veteran_identifier_spec.rb index ff93624926f..685b9e4db0c 100644 --- a/modules/claims_api/spec/requests/v2/rswag_veteran_identifier_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/rswag_veteran_identifier_spec.rb @@ -49,9 +49,7 @@ describe 'Getting a successful response' do response '201', "Veteran's unique identifier" do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'veteran_identifier', 'submission.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'veteran_identifier', 'submission.json').read ) before do |example| @@ -93,9 +91,7 @@ response '400', 'Bad Request' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json').read ) it 'returns a 400 response' do |example| @@ -122,9 +118,7 @@ response '401', 'Unauthorized' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json').read ) it 'returns a 401 response' do |example| @@ -153,9 +147,7 @@ response '404', 'Resource not found' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json').read ) it 'returns a 404 response' do |example| diff --git a/modules/claims_api/spec/requests/v2/veteran_identifier_request_spec.rb b/modules/claims_api/spec/requests/v2/veteran_identifier_spec.rb similarity index 85% rename from modules/claims_api/spec/requests/v2/veteran_identifier_request_spec.rb rename to modules/claims_api/spec/requests/v2/veteran_identifier_spec.rb index 5335a066222..b118054e425 100644 --- a/modules/claims_api/spec/requests/v2/veteran_identifier_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veteran_identifier_spec.rb @@ -4,8 +4,8 @@ require 'token_validation/v2/client' require_relative '../../rails_helper' -RSpec.describe 'Veteran Identifier Endpoint', type: :request, - openapi_spec: Rswag::TextHelpers.new.claims_api_docs do +RSpec.describe 'ClaimsApi::V2::VeteranIdentifier', openapi_spec: Rswag::TextHelpers.new.claims_api_docs, + type: :request do let(:path) { '/services/claims/v2/veteran-id:find' } let(:data) do { @@ -33,7 +33,7 @@ icn = JSON.parse(response.body)['id'] expect(icn).to eq(test_user_icn) - expect(response.status).to eq(201) + expect(response).to have_http_status(:created) end end end @@ -63,7 +63,7 @@ icn = JSON.parse(response.body)['id'] expect(icn).to eq(test_user_icn) - expect(response.status).to eq(201) + expect(response).to have_http_status(:created) end end end @@ -79,7 +79,7 @@ mock_ccg(scopes) do |auth_header| post path, params: data, headers: auth_header - expect(response.status).to eq(201) + expect(response).to have_http_status(:created) end end end @@ -89,7 +89,7 @@ mock_ccg(scopes) do |auth_header| allow_any_instance_of(ClaimsApi::ValidatedToken).to receive(:validated_token_data).and_return(nil) post path, params: data, headers: auth_header - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -102,7 +102,7 @@ it 'returns a 400 error code' do mock_ccg(scopes) do |auth_header| post path, params: data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -110,7 +110,7 @@ context 'when auth header is not present' do it 'returns a 401 error code' do post path, params: data - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end @@ -121,7 +121,7 @@ allow(veteran_mpi_data).to receive(:icn).and_return(nil) mock_ccg(scopes) do |auth_header| post path, params: data, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -134,7 +134,7 @@ invalid_data[:ssn] = '7961301159' post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -146,7 +146,7 @@ invalid_data[:ssn] = '79613011' post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -158,7 +158,7 @@ invalid_data[:ssn] = '796130 .A!' post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -170,7 +170,7 @@ invalid_data[:ssn] = '' post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -184,7 +184,7 @@ invalid_data[:birthdate] = '1234' post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -196,7 +196,7 @@ invalid_data[:birthdate] = (Time.zone.today + 1.year).to_s post path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -209,7 +209,7 @@ it 'returns a 404 error code' do mock_ccg(scopes) do |auth_header| post path, params: data, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end diff --git a/modules/claims_api/spec/requests/v2/veterans/disability_compensation_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/526_spec.rb similarity index 99% rename from modules/claims_api/spec/requests/v2/veterans/disability_compensation_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/526_spec.rb index 6d509532cf6..27e0535dbc6 100644 --- a/modules/claims_api/spec/requests/v2/veterans/disability_compensation_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/526_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require_relative '../../../rails_helper' -RSpec.describe 'Disability Claims', type: :request do +RSpec.describe 'ClaimsApi::V2::Veterans::526', type: :request do let(:scopes) { %w[claim.write claim.read] } let(:claim_date) { Time.find_zone!('Central Time (US & Canada)').today } let(:no_first_name_target_veteran) do diff --git a/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/claims/5103_spec.rb similarity index 96% rename from modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/claims/5103_spec.rb index 7070bad9420..e7380c4513e 100644 --- a/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/claims/5103_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../../rails_helper' +require_relative '../../../../rails_helper' -RSpec.describe 'Evidence Waiver 5103', type: :request do +RSpec.describe 'ClaimsApi::V2::Veterans::Claims::5103', type: :request do let(:veteran_id) { '1012667145V762142' } let(:sponsor_id) { '1012861229V078999' } let(:claim_id) { '600131328' } @@ -53,7 +53,7 @@ post sub_path, headers: auth_header - expect(response.status).to eq(202) + expect(response).to have_http_status(:accepted) end end end @@ -64,7 +64,7 @@ it 'returns a 401' do post sub_path, headers: { 'Authorization' => 'Bearer HelloWorld' } - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end @@ -77,7 +77,7 @@ post error_sub_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -99,7 +99,7 @@ post sub_path, headers: auth_header - expect(response.status).to eq(202) + expect(response).to have_http_status(:accepted) end end end @@ -119,7 +119,7 @@ post sub_path, headers: auth_header - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) json = JSON.parse(response.body) expect_res = json['errors'][0]['detail'] diff --git a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb similarity index 94% rename from modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/claims_spec.rb index 90996a3dcf1..05193c6e0bc 100644 --- a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/claims_spec.rb @@ -5,7 +5,7 @@ require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'Claims', type: :request do +RSpec.describe 'ClaimsApi::V2::Veterans::Claims', type: :request do let(:veteran_id) { '1013062086V794840' } let(:claimant_on_behalf_of_veteran_id) { '8675309' } let(:claim_id) { '600131328' } @@ -60,7 +60,7 @@ .to receive(:where).and_return([]) get all_claims_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -68,7 +68,7 @@ context 'when not provided' do it 'returns a 401 error code' do get all_claims_path - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -90,7 +90,7 @@ .to receive(:where).and_return([]) get all_claims_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -100,7 +100,7 @@ mock_ccg(scopes) do |auth_header| allow_any_instance_of(ClaimsApi::ValidatedToken).to receive(:validated_token_data).and_return(nil) get all_claims_path, headers: auth_header - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -114,7 +114,7 @@ it 'returns a 404 error code' do mock_ccg(scopes) do |auth_header| get all_claims_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -132,7 +132,7 @@ .to receive(:where).and_return([]) get all_claims_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -143,7 +143,7 @@ allow_any_instance_of(ClaimsApi::Veteran).to receive(:mpi_record?).and_return(nil) get all_claims_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -187,7 +187,7 @@ get all_claims_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) claim = json_response['data'].first claim_two = json_response['data'][1] expect(claim['attributes']['status']).to eq('COMPLETE') @@ -259,7 +259,7 @@ json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data'].count).to eq(3) expect(json_response['data'][0]['id']) .to eq(bgs_claims[:benefit_claims_dto][:benefit_claim][0][:benefit_claim_id]) @@ -294,7 +294,7 @@ get all_claims_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data'].count).to eq(4) expect(json_response['data'][0]['attributes']['lighthouseId']).to eq(lighthouse_claim.id) expect(json_response['data'][1]['attributes']['lighthouseId']).to eq(nil) @@ -325,7 +325,7 @@ } end - it "provides values for 'lighthouseId' and 'claimId' " do + it "provides values for 'lighthouseId' and 'claimId'" do lighthouse_claim = create( :auto_established_claim, id: '0958d973-36fb-43ef-8801-2718bd33c825', @@ -348,7 +348,7 @@ json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']).to be_an_instance_of(Array) expect(json_response.count).to eq(1) claim = json_response['data'].first @@ -377,7 +377,7 @@ end let(:lighthouse_claims) { [] } - it "provides a value for 'claimId', but 'lighthouseId' will be 'nil' " do + it "provides a value for 'claimId', but 'lighthouseId' will be 'nil'" do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/tracked_items/find_tracked_items') do expect_any_instance_of(bcs) @@ -388,14 +388,14 @@ get all_claims_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']).to be_an_instance_of(Array) expect(json_response.count).to eq(1) claim = json_response['data'].first expect(claim['attributes']['baseEndProductCode']).to eq('400') expect(claim['attributes']['status']).to eq('CLAIM_RECEIVED') expect(claim['id']).to eq('111111111') - expect(claim['attributes']['lighthouseId']).to be nil + expect(claim['attributes']['lighthouseId']).to be_nil end end end @@ -419,7 +419,7 @@ ] end - it "provides a value for 'lighthouseId', but 'claimId' will be 'nil' " do + it "provides a value for 'lighthouseId', but 'claimId' will be 'nil'" do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/tracked_items/find_tracked_items') do expect_any_instance_of(bcs) @@ -431,13 +431,13 @@ json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']).to be_an_instance_of(Array) expect(json_response.count).to eq(1) claim = json_response['data'].first expect(claim['attributes']['status']).to eq('PENDING') expect(claim['attributes']['lighthouseId']).to eq('0958d973-36fb-43ef-8801-2718bd33c825') - expect(claim['id']).to be nil + expect(claim['id']).to be_nil end end end @@ -454,13 +454,13 @@ json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']).to be_an_instance_of(Array) expect(json_response.count).to eq(1) claim = json_response['data'].first expect(claim['attributes']['status']).to eq('PENDING') expect(claim['attributes']['lighthouseId']).to eq('0958d973-36fb-43ef-8801-2718bd33c825') - expect(claim['id']).to be nil + expect(claim['id']).to be_nil end end end @@ -486,7 +486,7 @@ get all_claims_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']).to be_an_instance_of(Array) expect(json_response['data'].count).to eq(0) end @@ -505,7 +505,7 @@ get all_claims_path, headers: auth_header - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) json_response = JSON.parse(response.body) expect(json_response['errors'][0]['detail']).to eq( "Unable to locate Veteran's Participant ID in Master Person Index (MPI). " \ @@ -520,7 +520,7 @@ describe 'show with validate_id_with_icn' do let(:bgs_claim_response) { build(:bgs_response_with_one_lc_status).to_h } - describe ' BGS attributes' do + describe 'BGS attributes' do it 'are listed' do lh_claim = create(:auto_established_claim, status: 'PENDING', veteran_icn: veteran_id, evss_id: '111111111') @@ -536,7 +536,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']['attributes']['claimPhaseDates']['currentPhaseBack']).to eq(false) expect(json_response['data']['attributes']['claimPhaseDates']['latestPhaseType']) .to eq('CLAIM_RECEIVED') @@ -549,7 +549,7 @@ end context 'show with validate_id_with_icn when there is a claimant ID in place of the veteran ID' do - describe ' BGS attributes (w/ Claimant ID replacing vet ID)' do + describe 'BGS attributes (w/ Claimant ID replacing vet ID)' do it 'are listed' do bgs_claim_response = build(:bgs_response_claim_with_unmatched_ptcpnt_vet_id).to_h lh_claim = create(:auto_established_claim, status: 'PENDING', veteran_icn: '2023062086V8675309', @@ -569,7 +569,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) end end @@ -601,7 +601,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) claim_attributes = json_response['data']['attributes'] expect(claim_attributes['claimPhaseDates']['currentPhaseBack']).to eq(false) expect(claim_attributes['claimPhaseDates']['latestPhaseType']).to eq('CLAIM_RECEIVED') @@ -628,7 +628,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']['attributes']['supportingDocuments'].length).to eq(2) end end @@ -636,7 +636,7 @@ context 'when no auth header provided' do it 'returns a 401 error code' do get claim_by_id_path - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end @@ -650,7 +650,7 @@ get claim_by_id_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -676,7 +676,7 @@ mock_ccg(scopes) do |auth_header| get mismatched_claim_veteran_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -692,7 +692,7 @@ get matched_claim_veteran_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -702,7 +702,7 @@ let(:bgs_claim) { nil } describe "handling 'lighthouseId' and 'claimId'" do - it "provides a value for 'lighthouseId', but 'claimId' will be 'nil' " do + it "provides a value for 'lighthouseId', but 'claimId' will be 'nil'" do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/tracked_items/find_tracked_items') do expect_any_instance_of(bcs) @@ -711,10 +711,10 @@ get matched_claim_veteran_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('PENDING') - expect(json_response['data']['id']).to be nil + expect(json_response['data']['id']).to be_nil end end end @@ -737,7 +737,7 @@ get matched_claim_veteran_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['lighthouseId']).to eq(lighthouse_claim.id) expect(json_response['data']['id']).to eq('111111111') @@ -761,7 +761,7 @@ get claim_by_id_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -791,7 +791,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) claim_attributes = json_response['data']['attributes'] expect(json_response).to be_an_instance_of(Hash) expect(claim_attributes['lighthouseId']).to eq('0958d973-36fb-43ef-8801-2718bd33c825') @@ -804,7 +804,7 @@ end context 'and a Lighthouse claim does not exit' do - it "provides a value for 'claimId', but 'lighthouseId' will be 'nil' " do + it "provides a value for 'claimId', but 'lighthouseId' will be 'nil'" do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/tracked_items/find_tracked_items') do VCR.use_cassette('claims_api/evss/documents/get_claim_documents') do @@ -816,10 +816,10 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['id']).to eq('111111111') - expect(json_response['data']['attributes']['lighthouseId']).to be nil + expect(json_response['data']['attributes']['lighthouseId']).to be_nil end end end @@ -851,7 +851,7 @@ json_response = JSON.parse(response.body) expect(json_response['data']['attributes']['supportingDocuments']).to eq([]) - expect(response.status).not_to eq(404) + expect(response).not_to have_http_status(:not_found) end end end @@ -903,7 +903,7 @@ json_response = JSON.parse(response.body) expect(json_response['data']['attributes']['supportingDocuments']).to eq([]) - expect(response.status).not_to eq(404) + expect(response).not_to have_http_status(:not_found) end end end @@ -958,7 +958,7 @@ get claim_by_id_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -982,7 +982,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('EVIDENCE_GATHERING_REVIEW_DECISION') end @@ -1008,7 +1008,7 @@ d = Date.parse(bgs_claim[:benefit_claim_details_dto][:claim_complete_dt].to_s) expected_date = d.strftime('%Y-%m-%d') json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['closeDate']).to eq(expected_date) end @@ -1030,7 +1030,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('EVIDENCE_GATHERING_REVIEW_DECISION') end @@ -1064,7 +1064,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('EVIDENCE_GATHERING_REVIEW_DECISION') end @@ -1088,7 +1088,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('INITIAL_REVIEW') end @@ -1112,7 +1112,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['status']).to eq('INITIAL_REVIEW') expect(json_response['data']['attributes']['claimPhaseDates']['currentPhaseBack']).to eq(true) @@ -1141,7 +1141,7 @@ json_response = JSON.parse(response.body) prev_phases = json_response['data']['attributes']['claimPhaseDates']['previousPhases'] - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(prev_phases).to eq({}) end end @@ -1162,7 +1162,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['claimType']).to eq('Compensation') expect(json_response['data']['attributes']['status']).to eq('EVIDENCE_GATHERING_REVIEW_DECISION') @@ -1191,7 +1191,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) claim_contentions_res = json_response['data']['attributes']['contentions'] expect(claim_contentions_res).to eq([{ 'name' => 'c1 (New)' }, { 'name' => 'c2 (Old)' }, { 'name' => 'c3 (Unknown)' }]) @@ -1217,7 +1217,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) claim_contentions_res = json_response['data']['attributes']['contentions'] expect(claim_contentions_res).to eq([{ 'name' => 'Low back strain (New)' }, { 'name' => 'Knee, internal derangement (New)' }]) @@ -1243,7 +1243,7 @@ json_response = JSON.parse(response.body) first_doc_id = json_response['data']['attributes'].dig('supportingDocuments', 0, 'documentId') - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['claimType']).to eq('Compensation') expect(first_doc_id).to eq('{54EF0C16-A9E7-4C3F-B876-B2C7BEC1F834}') @@ -1270,7 +1270,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['claimType']).to eq('Compensation') expect(json_response['data']['attributes']['supportingDocuments']).to be_empty @@ -1299,7 +1299,7 @@ get matched_claim_veteran_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['supportingDocuments']).to be_empty end @@ -1331,7 +1331,7 @@ get claim_by_id_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']['attributes'].dig('errors', 0, 'detail')).to eq('ERROR Something happened') expect(json_response['data']['attributes'].dig('errors', 0, 'source')).to eq('test/path/here') expect(json_response['data']['attributes']['status']).to eq('ERRORED') @@ -1353,7 +1353,7 @@ get "/services/claims/v2/veterans/#{profile_erroneous_icn.profile.icn}/claims/#{claim_id}", headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) json_response = JSON.parse(response.body) expect(json_response['errors'][0]['detail']).to eq( "Unable to locate Veteran's ID/ICN in Master Person Index (MPI). " \ @@ -1382,7 +1382,7 @@ json_response = JSON.parse(response.body) first_doc_id = json_response['data']['attributes'].dig('trackedItems', 0, 'id') resp_tracked_items = json_response['data']['attributes']['trackedItems'] - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']['id']).to eq(claim_id_with_items) expect(first_doc_id).to eq(293_439) expect(resp_tracked_items[1]['description']).to eq(nil) @@ -1422,7 +1422,7 @@ first_doc_id = json_response['data']['attributes'].dig('trackedItems', 0, 'id') resp_tracked_items = json_response['data']['attributes']['trackedItems'] - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response['data']['id']).to eq(claim_id_with_items) expect(first_doc_id).to eq(293_439) expect(resp_tracked_items[0]['status']).to eq('SUBMITTED_AWAITING_REVIEW') @@ -1451,7 +1451,7 @@ get matched_claim_veteran_path, headers: auth_header json_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(json_response).to be_an_instance_of(Hash) expect(json_response['data']['attributes']['trackedItems']).to be_empty end @@ -1482,7 +1482,7 @@ .to receive(:find_benefit_claim_details_by_benefit_claim_id).and_return(nil) get claim_by_id_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -1494,7 +1494,7 @@ allow_any_instance_of(ClaimsApi::ValidatedToken).to receive(:validated_token_data).and_return(nil) get claim_by_id_path, headers: auth_header - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/intent_to_files_spec.rb similarity index 88% rename from modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/intent_to_files_spec.rb index 2867bc29e50..cb9067e24c5 100644 --- a/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/intent_to_files_spec.rb @@ -5,7 +5,7 @@ require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'IntentToFiles', type: :request do +RSpec.describe 'ClaimsApi::V2::Veterans::IntentToFiles', type: :request do let(:veteran_id) { '1013062086V794840' } let(:iws) do ClaimsApi::LocalBGS @@ -39,7 +39,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -47,7 +47,7 @@ context 'when not provided' do it 'returns a 401 error code' do get itf_type_path - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -69,7 +69,7 @@ it 'returns a 400' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -80,7 +80,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -91,7 +91,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -103,7 +103,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -114,7 +114,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -125,7 +125,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -138,7 +138,7 @@ it 'returns a 404' do mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -169,7 +169,7 @@ get itf_type_path, headers: auth_header parsed_response = JSON.parse(response.body) - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) expect(parsed_response['data']['id']).to eq('2') end end @@ -199,7 +199,7 @@ mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -228,7 +228,7 @@ mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -250,7 +250,7 @@ mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -270,7 +270,7 @@ mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end end @@ -294,14 +294,14 @@ mock_ccg(scopes) do |auth_header| get itf_type_path, headers: auth_header end - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end context 'when not valid' do it 'returns a 401' do get itf_type_path, headers: { 'Authorization' => 'Bearer HelloWorld' } - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -345,7 +345,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| post itf_submit_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -360,7 +360,7 @@ context 'when not provided' do it 'returns a 401 error code' do post itf_submit_path, params: data - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -370,7 +370,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| post itf_submit_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -389,7 +389,7 @@ it 'returns a 400' do mock_ccg(scopes) do |auth_header| post itf_submit_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -401,7 +401,7 @@ invalid_data[:data][:attributes][:type] = '' post itf_submit_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -413,7 +413,7 @@ invalid_data[:data][:attributes][:type] = nil post itf_submit_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -425,7 +425,7 @@ invalid_data[:data][:attributes][:type] = 'foo' post itf_submit_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -439,7 +439,7 @@ survivor_data[:data][:attributes][:type] = 'survivor' survivor_data[:data][:attributes][:claimantSsn] = '123456789' post itf_submit_path, params: survivor_data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -450,7 +450,7 @@ survivor_data[:data][:attributes][:type] = 'survivor' survivor_data[:data][:attributes][:claimantSsn] = '123-45-6789' post itf_submit_path, params: survivor_data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -462,7 +462,7 @@ survivor_data = data survivor_data[:data][:attributes][:type] = 'survivor' post itf_submit_path, params: survivor_data, headers: auth_header - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -474,7 +474,7 @@ survivor_data[:data][:attributes][:type] = 'survivor' survivor_data[:data][:attributes][:claimantSsn] = 'abcdefghi' post itf_submit_path, params: survivor_data, headers: auth_header - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -488,7 +488,7 @@ valid_data[:data][:attributes][:type] = 'CoMpEnSaTiOn' post itf_submit_path, params: valid_data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -501,7 +501,7 @@ mock_ccg(scopes) do |auth_header| post itf_submit_path, params: data, headers: auth_header end - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -509,7 +509,7 @@ it 'returns a 401' do post itf_submit_path, params: data, headers: { 'Authorization' => 'Bearer HelloWorld' } - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -550,7 +550,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| post itf_validate_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -558,7 +558,7 @@ context 'when not provided' do it 'returns a 401 error code' do post itf_validate_path, params: data - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -568,7 +568,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| post itf_validate_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -582,7 +582,7 @@ invalid_data[:data][:attributes][:type] = 'survivor' invalid_data[:data][:attributes][:claimantSsn] = '' post itf_validate_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(422) + expect(response).to have_http_status(:unprocessable_entity) end end end @@ -596,7 +596,7 @@ invalid_data[:data][:attributes][:type] = '' post itf_validate_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -608,7 +608,7 @@ invalid_data[:data][:attributes][:type] = nil post itf_validate_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -620,7 +620,7 @@ invalid_data[:data][:attributes][:type] = 'foo' post itf_validate_path, params: invalid_data, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -634,7 +634,7 @@ valid_data[:data][:attributes][:type] = 'CoMpEnSaTiOn' post itf_validate_path, params: valid_data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -648,7 +648,7 @@ post itf_validate_path, params: data, headers: auth_header end - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -656,7 +656,7 @@ it 'returns a 401' do post itf_validate_path, params: data, headers: { 'Authorization' => 'Bearer HelloWorld' } - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end @@ -698,7 +698,7 @@ it 'returns 200 when submitting to SUBMIT with correct body format' do mock_ccg(scopes) do |auth_header| post itf_submit_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -706,14 +706,14 @@ mock_ccg(scopes) do |auth_header| invalid_data_format = data[:data][:attributes] post itf_submit_path, params: invalid_data_format, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end it 'returns 200 when submitting to VALIDATE with correct body format' do mock_ccg(scopes) do |auth_header| post itf_validate_path, params: data, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -721,7 +721,7 @@ mock_ccg(scopes) do |auth_header| invalid_data_format = data[:data][:attributes] post itf_validate_path, params: invalid_data_format, headers: auth_header - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122_spec.rb similarity index 99% rename from modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122_spec.rb index e8562583688..b73cabee120 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../../rails_helper' +require_relative '../../../../rails_helper' require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'Power Of Attorney', type: :request do +RSpec.describe 'ClaimsApi::V1::PowerOfAttorney::2122', type: :request do let(:veteran_id) { '1013062086V794840' } let(:appoint_organization_path) { "/services/claims/v2/veterans/#{veteran_id}/2122" } let(:validate2122_path) { "/services/claims/v2/veterans/#{veteran_id}/2122/validate" } diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122a_spec.rb similarity index 99% rename from modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122a_spec.rb index 659b7e00baa..4cda3b35f0d 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/2122a_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../../rails_helper' +require_relative '../../../../rails_helper' require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'Power Of Attorney', type: :request do +RSpec.describe 'ClaimsApi::V1::PowerOfAttorney::2122a', type: :request do let(:veteran_id) { '1013062086V794840' } let(:appoint_individual_path) { "/services/claims/v2/veterans/#{veteran_id}/2122a" } let(:validate2122a_path) { "/services/claims/v2/veterans/#{veteran_id}/2122a/validate" } diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_new_poa_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_request_spec.rb similarity index 98% rename from modules/claims_api/spec/requests/v2/veterans/power_of_attorney_new_poa_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_request_spec.rb index a490c07a38c..8a0139593d2 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_new_poa_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_request_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../../rails_helper' +require_relative '../../../../rails_helper' require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'Power Of Attorney Request Controller', type: :request do +RSpec.describe 'ClaimsApi::V1::PowerOfAttorney::PowerOfAttorneyRequest', type: :request do let(:veteran_id) { '1013062086V794840' } let(:request_path) { "/services/claims/v2/veterans/#{veteran_id}/power-of-attorney-request" } let(:scopes) { %w[system/claim.write system/claim.read] } diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_spec.rb similarity index 95% rename from modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_spec.rb index 4e08bde48c5..f48fe81c68e 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney/power_of_attorney_spec.rb @@ -1,14 +1,13 @@ # frozen_string_literal: true require 'rails_helper' -require_relative '../../../rails_helper' +require_relative '../../../../rails_helper' require 'token_validation/v2/client' require 'bgs_service/local_bgs' -RSpec.describe 'Power Of Attorney', type: :request do +RSpec.describe 'ClaimsApi::V1::PowerOfAttorney::PowerOfAttorney', type: :request do let(:veteran_id) { '1013062086V794840' } let(:get_poa_path) { "/services/claims/v2/veterans/#{veteran_id}/power-of-attorney" } - let(:request_rep_path) { "/services/claims/v2/veterans/#{veteran_id}/power-of-attorney-request" } let(:scopes) { %w[system/claim.write system/claim.read] } let(:invalid_post_scopes) { %w[system/claim.read] } let(:individual_poa_code) { 'A1H' } @@ -37,7 +36,7 @@ get get_poa_path, headers: auth_header - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end end @@ -112,7 +111,7 @@ it 'returns a 401' do get get_poa_path, headers: { 'Authorization' => 'Bearer HelloWorld' } - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_5103_spec.rb similarity index 86% rename from modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/rswag_5103_spec.rb index 31451938061..fec65bba17e 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_5103_spec.rb @@ -58,13 +58,13 @@ describe 'Getting a successful response' do response '202', 'Successful response' do - schema JSON.parse(File.read(Rails.root.join('spec', - 'support', - 'schemas', - 'claims_api', - 'v2', - 'veterans', - 'submit_waiver_5103.json'))) + schema JSON.parse(Rails.root.join('spec', + 'support', + 'schemas', + 'claims_api', + 'v2', + 'veterans', + 'submit_waiver_5103.json').read) let(:scopes) { %w[system/claim.write] } let(:evidence_waiver_submission_request) {} @@ -102,8 +102,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', + 'default.json').read) let(:Authorization) { nil } let(:scopes) { %w[system/claim.read] } @@ -129,8 +129,8 @@ describe 'Getting a 404 response' do response '404', 'NotFound' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', + 'default.json').read) let(:Authorization) { nil } let(:scopes) { %w[system/claim.read] } diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_disability_compensation_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_526_spec.rb similarity index 100% rename from modules/claims_api/spec/requests/v2/veterans/rswag_disability_compensation_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/rswag_526_spec.rb diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb similarity index 85% rename from modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb rename to modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb index 8dfb2d682cd..a46e6961262 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_spec.rb @@ -38,18 +38,14 @@ describe 'Getting a successful response' do response '200', 'claim response' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'veterans', 'claims', - 'claims.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'veterans', 'claims', + 'claims.json').read ) let(:bgs_response) do bgs_data = JSON.parse( - File.read( - Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'v2', 'veterans', 'claims', - 'claims_by_participant_id_response.json') - ), + Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'v2', 'veterans', 'claims', + 'claims_by_participant_id_response.json').read, symbolize_names: true ) bgs_data[:benefit_claims_dto][:benefit_claim][0][:claim_dt] = Date.parse( @@ -88,8 +84,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', + 'default.json').read) let(:Authorization) { nil } let(:scopes) { %w[system/claim.read] } @@ -158,18 +154,14 @@ describe 'Getting a successful response' do response '200', 'claim response' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'veterans', 'claims', - 'claim.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'veterans', 'claims', + 'claim.json').read ) let(:bgs_response) do bgs_data = JSON.parse( - File.read( - Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'v2', 'veterans', 'claims', - 'claim_by_id_response.json') - ), + Rails.root.join('modules', 'claims_api', 'spec', 'fixtures', 'v2', 'veterans', 'claims', + 'claim_by_id_response.json').read, symbolize_names: true ) bgs_data[:benefit_claim_details_dto][:claim_dt] = Date.parse( @@ -210,8 +202,8 @@ describe 'Getting a 401 response' do response '401', 'Unauthorized' do - schema JSON.parse(File.read(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', - 'default.json'))) + schema JSON.parse(Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', + 'default.json').read) let(:Authorization) { nil } let(:scopes) { %w[system/claim.read] } @@ -237,9 +229,7 @@ describe 'Getting a 404 response' do response '404', 'Resource not found' do schema JSON.parse( - File.read( - Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json') - ) + Rails.root.join('spec', 'support', 'schemas', 'claims_api', 'v2', 'errors', 'default.json').read ) let(:veteran) { OpenStruct.new(mpi: nil, participant_id: nil) } let(:scopes) { %w[system/claim.read] }