Skip to content

Commit

Permalink
Removed some unused test code and updated the swagger specs for HCA
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshingYou1 committed Dec 24, 2024
1 parent fd68cdd commit 92a5f1f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 37 deletions.
15 changes: 0 additions & 15 deletions spec/lib/va1010_forms/utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,4 @@
end
end
end

describe '#override_parsed_form' do
context 'when the form contains a Mexican province as an address state' do
subject do
super().override_parsed_form(form_with_mexican_province)
end

let(:form_with_mexican_province) { get_fixture('form1010_ezr/valid_form_with_mexican_province') }

it 'returns the correct corresponding province abbreviation' do
expect(subject['veteranAddress']['state']).to eq('CHIH.')
expect(subject['veteranHomeAddress']['state']).to eq('CHIH.')
end
end
end
end
87 changes: 65 additions & 22 deletions spec/requests/swagger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -806,39 +806,82 @@
expect(subject).to validate(:post, '/v0/hca_attachments', 400, '')
end

it 'supports submitting a health care application', run_at: '2017-01-31' do
VCR.use_cassette('hca/submit_anon', match_requests_on: [:body]) do
context "when the 'va1010_forms_enrollment_system_service_enabled' flipper is enabled" do
it 'supports submitting a health care application', run_at: '2017-01-31' do
VCR.use_cassette('hca/submit_anon', match_requests_on: [:body]) do
expect(subject).to validate(
:post,
'/v0/health_care_applications',
200,
'_data' => {
'form' => test_veteran
}
)
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
200,
422,
'_data' => {
'form' => {}.to_json
}
)

allow_any_instance_of(HCA::Service).to receive(:submit_form) do
raise Common::Client::Errors::HTTPError, 'error message'
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
400,
'_data' => {
'form' => test_veteran
}
)
end
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
422,
'_data' => {
'form' => {}.to_json
}
)

allow_any_instance_of(HCA::Service).to receive(:post) do
raise Common::Client::Errors::HTTPError, 'error message'
context "when the 'va1010_forms_enrollment_system_service_enabled' flipper is disabled" do
before do
Flipper.disable(:va1010_forms_enrollment_system_service_enabled)
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
400,
'_data' => {
'form' => test_veteran
}
)
it 'supports submitting a health care application', run_at: '2017-01-31' do
VCR.use_cassette('hca/submit_anon', match_requests_on: [:body]) do
expect(subject).to validate(
:post,
'/v0/health_care_applications',
200,
'_data' => {
'form' => test_veteran
}
)
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
422,
'_data' => {
'form' => {}.to_json
}
)

allow_any_instance_of(HCA::Service).to receive(:post) do
raise Common::Client::Errors::HTTPError, 'error message'
end

expect(subject).to validate(
:post,
'/v0/health_care_applications',
400,
'_data' => {
'form' => test_veteran
}
)
end
end
end

Expand Down

0 comments on commit 92a5f1f

Please sign in to comment.