Sha256: eacaf5cb661231fbef9b2b86f0c0bbb31e6e81b068ecac8d65efeb0c5b9c776f

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

require 'spec_helper'
module Alf
  module Support
    describe Config, '[]' do

      let(:conf_subclass){
        Class.new(Config){
          option :ready, Boolean, false
          option :preferences, Array, ["foo"]
        }
      }

      let(:config){ conf_subclass.new }

      subject{ config[attr] }

      context 'on a boolean' do
        let(:attr){ :ready }

        it{ should eq(false) }
      end

      context 'on a non-boolean' do
        let(:attr){ :preferences }

        it{ should eq(["foo"]) }
      end

      context 'after being set' do
        let(:attr){ :preferences }

        before do
          config.preferences = ["bar"]
        end

        it{ should eq(["bar"]) }
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-support/config/test_hash_get.rb
alf-core-0.14.0 spec/unit/alf-support/config/test_hash_get.rb