Fixes response validators specs for v3 structure

This commit is contained in:
Jay Danielian 2019-07-18 22:01:00 -04:00
parent 659b328eda
commit aa59c5ff91

View File

@ -11,7 +11,7 @@ module Rswag
allow(config).to receive(:get_swagger_doc).and_return(swagger_doc) allow(config).to receive(:get_swagger_doc).and_return(swagger_doc)
end end
let(:config) { double('config') } let(:config) { double('config') }
let(:swagger_doc) { {} } let(:swagger_doc) { {:components => {}} }
let(:example) { double('example') } let(:example) { double('example') }
let(:metadata) do let(:metadata) do
{ {
@ -58,14 +58,21 @@ module Rswag
context 'referenced schemas' do context 'referenced schemas' do
before do before do
swagger_doc[:definitions] = { # swagger_doc[:definitions] = {
'blog' => { # 'blog' => {
type: :object, # type: :object,
properties: { foo: { type: :string } }, # properties: { foo: { type: :string } },
required: ['foo'] # required: ['foo']
} # }
# }
swagger_doc[:components][:schemas] = {
'blog' => {
type: :object,
properties: { foo: { type: :string } },
required: ['foo']
}
} }
metadata[:response][:schema] = { '$ref' => '#/definitions/blog' } metadata[:response][:schema] = { '$ref' => '#/components/schemas/blog' }
end end
it 'uses the referenced schema to validate the response body' do it 'uses the referenced schema to validate the response body' do