Sha256: 3e3380f744e41bf912dab9908a0fd9141db635d0b571f17ad57d5fdf949d2231
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Grape::Middleware::Globals do subject { described_class.new(blank_app) } before { allow(subject).to receive(:dup).and_return(subject) } let(:blank_app) { ->(_env) { [200, {}, 'Hi there.'] } } it 'calls through to the app' do expect(subject.call({})).to eq([200, {}, 'Hi there.']) end context 'environment' do it 'sets the grape.request environment' do subject.call({}) expect(subject.env['grape.request']).to be_a(Grape::Request) end it 'sets the grape.request.headers environment' do subject.call({}) expect(subject.env['grape.request.headers']).to be_a(Hash) end it 'sets the grape.request.params environment' do subject.call('QUERY_STRING' => 'test=1', 'rack.input' => StringIO.new) expect(subject.env['grape.request.params']).to be_a(Hash) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-1.6.2 | spec/grape/middleware/globals_spec.rb |
grape-1.6.1 | spec/grape/middleware/globals_spec.rb |