spec/grape/request_spec.rb in grape-1.6.0 vs spec/grape/request_spec.rb in grape-1.6.1

- old
+ new

@@ -19,11 +19,11 @@ let(:params) { default_params } let(:options) { default_options } let(:env) { default_env } let(:request) do - Grape::Request.new(env) + described_class.new(env) end describe '#params' do let(:params) do { @@ -36,11 +36,11 @@ expect(request.params).to eq(ActiveSupport::HashWithIndifferentAccess.new('a' => '123', 'b' => 'xyz')) end context 'when build_params_with: Grape::Extensions::Hash::ParamBuilder is specified' do let(:request) do - Grape::Request.new(env, build_params_with: Grape::Extensions::Hash::ParamBuilder) + described_class.new(env, build_params_with: Grape::Extensions::Hash::ParamBuilder) end it 'returns symbolized params' do expect(request.params).to eq(a: '123', b: 'xyz') end @@ -63,28 +63,30 @@ end end end describe 'when the param_builder is set to Hashie' do + subject(:request_params) { described_class.new(env, **opts).params } + before do Grape.configure do |config| config.param_builder = Grape::Extensions::Hashie::Mash::ParamBuilder end end after do Grape.config.reset end - subject(:request_params) { Grape::Request.new(env, **opts).params } - context 'when the API does not include a specific param builder' do let(:opts) { {} } + it { is_expected.to be_a(Hashie::Mash) } end context 'when the API includes a specific param builder' do let(:opts) { { build_params_with: Grape::Extensions::Hash::ParamBuilder } } + it { is_expected.to be_a(Hash) } end end describe '#headers' do