Sha256: 0f6324d26e0f2d049ed264e34963c12e910494c4e41cb5d17f4f099503c1b61d

Contents?: true

Size: 606 Bytes

Versions: 7

Compression:

Stored size: 606 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
grape-swagger-0.26.1 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.26.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.25.3 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.25.2 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.25.1 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.25.0 spec/swagger_v2/security_requirement_spec.rb
grape-swagger-0.24.0 spec/swagger_v2/security_requirement_spec.rb