Sha256: 756145c5ddf2d9bb8f1ba3f66d7a937e008d34691cb784e649787711accf8c87

Contents?: true

Size: 670 Bytes

Versions: 3

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

describe Grape::Endpoint do
  subject { Class.new(Grape::API) }

  def app
    subject
  end

  before do
    subject.namespace :api do
      get ':id' do
        [params[:id], params[:ext]].compact.join('/')
      end

      put ':something_id' do
        params[:something_id]
      end
    end
  end

  context 'get' do
    it 'responds' do
      get '/api/foo'
      expect(last_response.status).to eq 200
      expect(last_response.body).to eq 'foo'
    end
  end

  context 'put' do
    it 'responds' do
      put '/api/foo'
      expect(last_response.status).to eq 200
      expect(last_response.body).to eq 'foo'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-1.8.0 spec/grape/api/required_parameters_in_route_spec.rb
grape-1.7.1 spec/grape/api/required_parameters_in_route_spec.rb
grape-1.7.0 spec/grape/api/required_parameters_in_route_spec.rb