Request Spec
# vets-api/spec/request/email_request_spec.rb
describe 'GET /v0/profile/email' do
it 'should match the email schema' do
VCR.use_cassette('evss/pciu/email') do
get '/v0/profile/email', nil, auth_header
expect(response).to match_response_schema('email_address_response')
end
end
end
CODE
Associated Support Response Schema
// vets-api/spec/support/schemas/email_address_response.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {},
"properties": {
"data": {
"properties": {
"attributes": {
"properties": {
"email": {
"type": "string"
},
"effective_at": {
"type": "string"
}
},
"type": "object"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
CODE
Derived from Endpoint Response
{
"data": {
"id": "",
"type": "evss_pciu_email_address_responses",
"attributes": {
"email": "john@example.com",
"effective_at": "2018-02-27T14:41:32.283Z"
}
}
}
CODE
Help and feedback