Adds rswag to test and development so rake tasks work

Adds to swagger_Formatter to remove injected body parameters since those are 2.0 and ont 3.0 compliant

Adds to example_group_helpers to only automatically save request examples in the swagger output on 2xx response, since otherwise it was getting clobbered
This commit is contained in:
Jay Danielian
2019-07-07 22:57:55 -04:00
parent 297cc447c8
commit 0093efd4bf
5 changed files with 66 additions and 186 deletions

View File

@@ -6,7 +6,7 @@ namespace :rswag do
desc 'Generate Swagger JSON files from integration specs'
RSpec::Core::RakeTask.new('swaggerize') do |t|
t.pattern = 'spec/requests/**/*_spec.rb, spec/api/**/*_spec.rb, spec/integration/**/*_spec.rb'
# TODO: fix this, as dry-run is always true despite what is in the config
# NOTE: rspec 2.x support
if Rswag::Specs::RSPEC_VERSION > 2 && Rswag::Specs.config.swagger_dry_run
t.rspec_opts = [ '--format Rswag::Specs::SwaggerFormatter', '--dry-run', '--order defined' ]