Sha256: 98cfe744e6e961413dca618f4b255ad8085075663338934df78c5fc0620f69d8
Contents?: true
Size: 1.69 KB
Versions: 9
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' describe 'global configuration stuff' do before :all do module TheApi class ConfigurationApi < Grape::API format :json version 'v3', using: :path desc 'This returns something', failure: [{ code: 400, message: 'NotFound' }] params do requires :foo, type: Integer end get :configuration do { 'declared_params' => declared(params) } end add_swagger_documentation format: :json, doc_version: '23', schemes: 'https', host: -> { 'another.host.com' }, base_path: -> { 'somewhere/over/the/rainbow' }, mount_path: 'documentation', add_base_path: true, add_version: true, security_definitions: { api_key: { foo: 'bar' } } end end end def app TheApi::ConfigurationApi end describe 'shows documentation paths' do subject do get '/v3/documentation' JSON.parse(last_response.body) end specify do expect(subject['info']['version']).to eql '23' expect(subject['host']).to eql 'another.host.com' expect(subject['basePath']).to eql 'somewhere/over/the/rainbow' expect(subject['paths'].keys.first).to eql '/somewhere/over/the/rainbow/v3/configuration' expect(subject['schemes']).to eql ['https'] expect(subject['securityDefinitions'].keys).to include('api_key') expect(subject['securityDefinitions']['api_key']).to include('foo' => 'bar') end end end
Version data entries
9 entries across 9 versions & 1 rubygems