Sha256: 855d9b0f5cd6c7062298af4e73bb1faf8de0073d71421059d5b8742c395b2f47

Contents?: true

Size: 637 Bytes

Versions: 11

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'security requirement on endpoint method' do
  def app
    Class.new(Grape::API) do
      desc 'Endpoint with security requirement', security: [oauth_pets: ['read:pets', 'write:pets']]
      get '/with_security' do
        { foo: 'bar' }
      end

      add_swagger_documentation
    end
  end

  subject do
    get '/swagger_doc.json'
    JSON.parse(last_response.body)
  end

  it 'defines the security requirement on the endpoint method' do
    expect(subject['paths']['/with_security']['get']['security']).to eql ['oauth_pets' => ['read:pets', 'write:pets']]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
grape-swagger-0.32.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.31.1 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.31.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.30.1 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.30.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.29.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.28.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.27.3 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.27.2 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.27.1 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.27.0 spec/swagger_v2/security_requirement_spec.rb