-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
When running OPENAPI=1 rspec spec/requests/samples_spec.rb:15
is run, the schema that is not under test is also deleted.
request spec
describe 'Sample API TEST', :api_admin, type: :request do
let(:headers) { { headersample: "headersample" } }
let(:sample) { create(:sample, name: "srockstyle") }
let(:params) { { } }
before do
restaurant
end
it 'Test A' do
get "/v1/sample", headers: headers, params: params
expect(response).to(have_http_status(200))
end
it 'Test B' do
get "/v1/sample/#{sample.id}", headers: headers, params: params
expect(response).to(have_http_status(200))
end
end
openapi.yaml created after running OPENAPI=1 rspec spec/requests/samples_spec.rb
---
openapi: 3.0.3
info:
title: app
version: 1.0.0
servers: []
paths:
"/v1/samples":
post:
summary: index
tags:
- Sample
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
responses:
'200':
description: Index sample
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
example:
- id: 1
name: srockstyle
job: sample
"/v1/samples/{id}":
post:
summary: index
tags:
- Sample
responses:
'200':
description: Index sample
content:
application/json:
schema:
type: object
properties:
id:
type: integer
name:
type: string
example:
id: 1
name: srockstyle
job: sample
Then spec was specified on a line and the command was executed OPENAPI=1 rspec spec/requests/samples_spec.rb:10
,
yaml left only the specified parts and deleted the parts that were not specified.
---
openapi: 3.0.3
info:
title: app
version: 1.0.0
servers: []
paths:
"/v1/samples":
post:
summary: index
tags:
- Sample
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
responses:
'200':
description: Index sample
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
example:
- id: 1
name: srockstyle
job: sample
I expect the following behavior, are there any options?
- Do not delete schema that is not to be executed
- get request" is processed as "post request", so we want to treat it as "get".
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers