Sha256: fa0cd2d995e570ee5327754eaaae0af0f37d802c16f7b66e982f956c839462a6
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec::Matchers.define_negated_matcher :exclude, :include describe '#884 dont document non-schema examples' do let(:app) do Class.new(Grape::API) do namespace :issue_884 do params do requires :id, type: Integer, documentation: { example: 123 } optional :name, type: String, documentation: { example: 'Buddy Guy' } end post 'document_example' do present params end desc 'do not document this' do consumes ['application/x-www-form-urlencoded'] end params do requires :id, type: Integer, documentation: { example: 123 } optional :name, type: String, documentation: { example: 'Buddy Guy' } end post 'dont_document_example' do present params end end add_swagger_documentation format: :json end end subject do get '/swagger_doc' JSON.parse(last_response.body) end let(:parameters_document_example) { subject['definitions']['postIssue884DocumentExample']['properties'] } let(:parameters_dont_document_example) { subject['paths']['/issue_884/dont_document_example']['post']['parameters'] } specify do expect(parameters_document_example.values).to all(include('example')) expect(parameters_dont_document_example).to all(exclude('example')) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gitlab-grape-swagger-1.5.0 | spec/issues/884_dont_document_non_schema_examples_spec.rb |