Support setting examples for response

Add helper method `response_examples` to inject response examples to swagger
This commit is contained in:
vinhbachsy
2016-10-18 21:44:04 +08:00
parent 3506fee3d0
commit 10dd37896f
2 changed files with 11 additions and 1 deletions

View File

@@ -52,6 +52,12 @@ describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do
response '200', 'blog found' do
schema '$ref' => '#/definitions/blog'
response_examples 'application/json' => {
id: 1,
title: 'Hello world!',
content: 'Hello world and hello universe. Thank you all very much!!!'
}
let(:blog) { Blog.create(title: 'foo', content: 'bar') }
let(:id) { blog.id }
run_test!