Sha256: 2f114131ca0693088b9aaecd7307847072d7ecb80b1e8620fbc81ce0eb0cf218

Contents?: true

Size: 973 Bytes

Versions: 13

Compression:

Stored size: 973 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
module Grape
  module Util
    describe 'StrictHashConfiguration' do
      subject do
        Class.new do
          include Grape::Util::StrictHashConfiguration.module(:config1, :config2, config3: [:config4], config5: [config6: %i[config7 config8]])
        end
      end

      it 'set nested configs' do
        subject.configure do
          config1 'alpha'
          config2 'beta'

          config3 do
            config4 'gamma'
          end

          local_var = 8

          config5 do
            config6 do
              config7 7
              config8 local_var
            end
          end
        end

        expect(subject.settings).to eq(config1: 'alpha',
                                       config2: 'beta',
                                       config3: { config4: 'gamma' },
                                       config5: { config6: { config7: 7, config8: 8 } })
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
grape-1.6.2 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.6.1 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.6.0 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.5.3 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.5.2 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.5.1 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.5.0 spec/grape/util/strict_hash_configuration_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/spec/grape/util/strict_hash_configuration_spec.rb
grape-1.4.0 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.3.3 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.3.2 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.3.1 spec/grape/util/strict_hash_configuration_spec.rb
grape-1.3.0 spec/grape/util/strict_hash_configuration_spec.rb