Sha256: 921aa944b22bc442456cb9d36e3ab15f5eff7ea0c52ffcf6e5e698ec7d144b07
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true describe Rack do it 'correctly populates params from a Tempfile' do input = Tempfile.new 'rubbish' begin app = Class.new(Grape::API) do format :json post do { params_keys: params.keys } end end input.write({ test: '123' * 10_000 }.to_json) input.rewind options = { input: input, method: 'POST', 'CONTENT_TYPE' => 'application/json' } env = Rack::MockRequest.env_for('/', options) expect(JSON.parse(read_chunks(app.call(env)[2]).join)['params_keys']).to match_array('test') ensure input.close input.unlink end end context 'when the app is mounted' do let(:ping_mount) do Class.new(Grape::API) do get 'ping' end end let(:app) do app_to_mount = ping_mount app = Class.new(Grape::API) do namespace 'namespace' do mount app_to_mount end end Rack::Builder.new(app) end it 'finds the app on the namespace' do get '/namespace/ping' expect(last_response.status).to eq 200 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-1.8.0 | spec/grape/integration/rack_spec.rb |
grape-1.7.1 | spec/grape/integration/rack_spec.rb |