Sha256: 831128f7d274043d62bf670154e37fcd8642a782ea8149b81e1bfb0ba5fb2997

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require './lib/conferrable'

describe Conferrable::Configuration do
  it 'should accept no initialization arguments' do
    config = Conferrable::Configuration.new

    expect(config.all['doesnt_exist']).to be nil
  end

  it 'should accept multiple hashes as initialization arguments' do
    c1 = { 'admin' => true }
    c2 = { 'admin' => false }

    config = Conferrable::Configuration.new(c1, c2)

    expect(config.all['admin']).to be false
  end

  it 'should accept one hash as an initialization argument' do
    config = Conferrable::Configuration.new('admin' => true)

    expect(config.all['admin']).to be true
  end

  it 'should allow get to work with nested depths' do
    c1 = { 'options' => { 'admin' => true } }
    c2 = { 'options' => { 'admin' => false } }

    config = Conferrable::Configuration.new(c1, c2)

    expect(config.all.dig('options', 'admin')).to be false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conferrable-1.0.3 spec/configuration_spec.rb