Sha256: 4e4c27d131c05d78f4405a8bfcdba70f912d1a0514b0ebd87ab740f1aa49d3a4
Contents?: true
Size: 953 Bytes
Versions: 3
Compression:
Stored size: 953 Bytes
Contents
# frozen_string_literal: true describe Grape::API::Instance do describe 'boolean constant' do module DefinesBooleanInstanceSpec class API < Grape::API params do requires :message, type: Boolean end post :echo do { class: params[:message].class.name, value: params[:message] } end end end def app DefinesBooleanInstanceSpec::API end let(:expected_body) do { class: 'TrueClass', value: true }.to_s end it 'sets Boolean as a type' do post '/echo?message=true' expect(last_response.status).to eq(201) expect(last_response.body).to eq expected_body end context 'Params endpoint type' do subject { DefinesBooleanInstanceSpec::API.new.router.map['POST'].first.options[:params]['message'][:type] } it 'params type is a boolean' do expect(subject).to eq 'Grape::API::Boolean' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grape-1.8.0 | spec/grape/api/defines_boolean_in_params_spec.rb |
grape-1.7.1 | spec/grape/api/defines_boolean_in_params_spec.rb |
grape-1.7.0 | spec/grape/api/defines_boolean_in_params_spec.rb |