Sha256: 2ec89ba8d950102bea1259eb7e7b45d5fe53743143a871154a2dc46c03310189

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

module Spec
  module Support
    # container for methods used in specs
    module RouteMatcherHelpers
      def self.api
        Class.new(Grape::API) do
          version 'v1'
          prefix 'api'
          format 'json'

          get 'custom_name', as: :my_custom_route_name do
            'hello'
          end

          get 'ping' do
            'pong'
          end

          resource :cats do
            get '/' do
              %w(cats cats cats)
            end

            route_param :id do
              get do
                'cat'
              end
            end
          end

          route :any, '*path' do
            'catch-all route'
          end
        end
      end

      def self.mounting_api
        Class.new(Grape::API) do
          mount Spec::Support::RouteMatcherHelpers.api
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-route-helpers-1.2.0 spec/support/route_matcher_helpers.rb