diff --git a/spec/requests/v1/gi/lcpe/exams_spec.rb b/spec/requests/v1/gi/lcpe/exams_spec.rb new file mode 100644 index 00000000000..a82b1828c3f --- /dev/null +++ b/spec/requests/v1/gi/lcpe/exams_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'V1::GI::LCPE::Exams', type: :request do + include SchemaMatchers + + describe 'GET v1/gi/lcpe/exams' do + context 'Retrieves exam data for GI Bill Comparison Tool' do + it 'returns 200 response' do + VCR.use_cassette('gi/lcpe/get_exams_v1') do + get v1_gi_lcpe_exams_url, params: nil + expect(response).to have_http_status(:ok) + expect(response).to match_response_schema('gi/lcpe/exams') + end + end + end + end +end diff --git a/spec/requests/v1/gi/lcpe/lacs_spec.rb b/spec/requests/v1/gi/lcpe/lacs_spec.rb new file mode 100644 index 00000000000..94131a75770 --- /dev/null +++ b/spec/requests/v1/gi/lcpe/lacs_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'V1::GI::LCPE::Lacs', type: :request do + include SchemaMatchers + + describe 'GET v1/gi/lcpe/lacs' do + context 'Retrieves licenses and certifications data for GI Bill Comparison Tool' do + it 'returns 200 response' do + VCR.use_cassette('gi/lcpe/get_licenses_and_certs_v1') do + get v1_gi_lcpe_lacs_url, params: nil + expect(response).to have_http_status(:ok) + expect(response).to match_response_schema('gi/lcpe/lacs') + end + end + end + end + + describe 'GET v1/gi/lcpe/lacs/:id' do + context 'Retrieves license and certification details for GI Bill Comparison Tool' do + it 'returns 200 response' do + VCR.use_cassette('gi/lcpe/get_license_and_cert_details_v1') do + get v1_gi_lcpe_lacs_url + '/1@f9822' + expect(response).to have_http_status(:ok) + expect(response).to match_response_schema('gi/lcpe/lac') + end + end + end + end +end diff --git a/spec/support/schemas/gi/lcpe/exams.json b/spec/support/schemas/gi/lcpe/exams.json new file mode 100644 index 00000000000..6a4f4436843 --- /dev/null +++ b/spec/support/schemas/gi/lcpe/exams.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "exams": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "enriched_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tests": { + "type": [ + "array", + "null" + ], + "items": { + "type": "object", + "properties" : { + "name": { + "type": "string" + }, + "fee": { + "type": ["string", "null"] + }, + "begin_date": { + "type": ["string", "null"] + }, + "end_date": { + "type": ["string", "null"] + } + } + } + }, + "institution": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "institution.json" + } + ] + } + } + } + } + } + } + \ No newline at end of file diff --git a/spec/support/schemas/gi/lcpe/institution.json b/spec/support/schemas/gi/lcpe/institution.json new file mode 100644 index 00000000000..800fb34bca1 --- /dev/null +++ b/spec/support/schemas/gi/lcpe/institution.json @@ -0,0 +1,62 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "physical_address": { + "type": "object", + "properties": { + "address_1": { + "type": ["string", "null"] + }, + "address_2": { + "type": ["string", "null"] + }, + "address_3": { + "type": ["string", "null"] + }, + "city": { + "type": ["string", "null"] + }, + "state": { + "type": ["string", "null"] + }, + "zip": { + "type": ["string", "null"] + }, + "country": { + "type": ["string", "null"] + } + } + }, + "mailing_address": { + "type": "object", + "properties": { + "address_1": { + "type": ["string", "null"] + }, + "address_2": { + "type": ["string", "null"] + }, + "address_3": { + "type": ["string", "null"] + }, + "city": { + "type": ["string", "null"] + }, + "state": { + "type": ["string", "null"] + }, + "zip": { + "type": ["string", "null"] + }, + "country": { + "type": ["string", "null"] + } + } + } + } + } diff --git a/spec/support/schemas/gi/lcpe/lac.json b/spec/support/schemas/gi/lcpe/lac.json new file mode 100644 index 00000000000..bc54f81640d --- /dev/null +++ b/spec/support/schemas/gi/lcpe/lac.json @@ -0,0 +1,49 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lac": { + "type": "object", + "additionalProperties": false, + "properties": { + "enriched_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "tests": { + "type": [ + "array", + "null" + ], + "items": { + "type": "object", + "properties" : { + "name": { + "type": "string" + }, + "fee": { + "type": ["string", "null"] + } + } + } + }, + "institution": { + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "institution.json" + } + ] + } + } + } + } + } + \ No newline at end of file diff --git a/spec/support/schemas/gi/lcpe/lacs.json b/spec/support/schemas/gi/lcpe/lacs.json new file mode 100644 index 00000000000..6c0b3697d59 --- /dev/null +++ b/spec/support/schemas/gi/lcpe/lacs.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lacs": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "enriched_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } + } + } + \ No newline at end of file diff --git a/spec/support/vcr_cassettes/gi/lcpe/get_licenses_and_certs_v1.yml b/spec/support/vcr_cassettes/gi/lcpe/get_licenses_and_certs_v1.yml index 26fbd949be5..d16d20b5d77 100644 --- a/spec/support/vcr_cassettes/gi/lcpe/get_licenses_and_certs_v1.yml +++ b/spec/support/vcr_cassettes/gi/lcpe/get_licenses_and_certs_v1.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/v1/lcpe/lacs/" + uri: "/v1/lcpe/lacs" body: encoding: US-ASCII string: ''