Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rspec-rails-swagger
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
rspec-rails-swagger
Commits
fcd9706f
Commit
fcd9706f
authored
Oct 02, 2016
by
andrew morton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper for setting tags
parent
c3f38ff9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
formatter.rb
lib/rspec/rails/swagger/formatter.rb
+1
-1
helpers.rb
lib/rspec/rails/swagger/helpers.rb
+4
-0
helpers_spec.rb
spec/rspec/rails/swagger/helpers_spec.rb
+30
-0
No files found.
lib/rspec/rails/swagger/formatter.rb
View file @
fcd9706f
...
@@ -107,7 +107,7 @@ module RSpec
...
@@ -107,7 +107,7 @@ module RSpec
operation
[
:parameters
]
=
prepare_parameters
(
swagger_operation
[
:parameters
])
operation
[
:parameters
]
=
prepare_parameters
(
swagger_operation
[
:parameters
])
end
end
operation
.
merge!
(
swagger_operation
.
slice
(
operation
.
merge!
(
swagger_operation
.
slice
(
:summary
,
:description
,
:externalDocs
,
:operationId
,
:
tags
,
:
summary
,
:description
,
:externalDocs
,
:operationId
,
:consumes
,
:produces
,
:schemes
,
:deprecated
,
:security
:consumes
,
:produces
,
:schemes
,
:deprecated
,
:security
))
))
end
end
...
...
lib/rspec/rails/swagger/helpers.rb
View file @
fcd9706f
...
@@ -174,6 +174,10 @@ module RSpec
...
@@ -174,6 +174,10 @@ module RSpec
metadata
[
:swagger_operation
][
:produces
]
=
mime_types
metadata
[
:swagger_operation
][
:produces
]
=
mime_types
end
end
def
tags
*
tags
metadata
[
:swagger_operation
][
:tags
]
=
tags
end
def
response
status_code
,
attributes
=
{},
&
block
def
response
status_code
,
attributes
=
{},
&
block
attributes
.
symbolize_keys!
attributes
.
symbolize_keys!
...
...
spec/rspec/rails/swagger/helpers_spec.rb
View file @
fcd9706f
...
@@ -186,6 +186,36 @@ RSpec.describe RSpec::Rails::Swagger::Helpers::Operation do
...
@@ -186,6 +186,36 @@ RSpec.describe RSpec::Rails::Swagger::Helpers::Operation do
end
end
subject
{
klass
.
new
}
subject
{
klass
.
new
}
describe
'#consumes'
do
before
{
subject
.
metadata
=
{
swagger_operation:
{}}
}
it
'accepts an array'
do
subject
.
consumes
(
'foo'
,
'bar'
)
expect
(
subject
.
metadata
[
:swagger_operation
][
:consumes
]).
to
eq
[
'foo'
,
'bar'
]
end
end
describe
'#produces'
do
before
{
subject
.
metadata
=
{
swagger_operation:
{}}
}
it
'accepts an array'
do
subject
.
produces
(
'foo'
,
'bar'
)
expect
(
subject
.
metadata
[
:swagger_operation
][
:produces
]).
to
eq
[
'foo'
,
'bar'
]
end
end
describe
'#tags'
do
before
{
subject
.
metadata
=
{
swagger_operation:
{}}
}
it
'accepts an array'
do
subject
.
tags
(
'foo'
,
'bar'
)
expect
(
subject
.
metadata
[
:swagger_operation
][
:tags
]).
to
eq
[
'foo'
,
'bar'
]
end
end
describe
'#response'
do
describe
'#response'
do
before
{
subject
.
metadata
=
{
swagger_object: :operation
}
}
before
{
subject
.
metadata
=
{
swagger_object: :operation
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment