Sha256: 7d266b3bc8c281d1ab1de23defae74a4d01d42061f63e9e916dd6700d6e80603
Contents?: true
Size: 880 Bytes
Versions: 3
Compression:
Stored size: 880 Bytes
Contents
# frozen_string_literal: true 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grape-1.8.0 | spec/grape/middleware/globals_spec.rb |
grape-1.7.1 | spec/grape/middleware/globals_spec.rb |
grape-1.7.0 | spec/grape/middleware/globals_spec.rb |