Sha256: a33727420fabed7328fcfe453f9d9d2a0797f5ef013f6da57755a6243975369e

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Rgentpl::Configuration do
  before :each do
    @configuration = Rgentpl::Configuration.new
  end

  describe 'given expected attributes' do
    [:active,
     :log_file,
     :options].each do |expected_attribute|
      it 'responds to each of them' do
        expect(@configuration).to respond_to expected_attribute
      end
    end
  end

  describe '#config' do
    it 'is an Rgentpl::Configuration object' do
      expect(Rgentpl.config).to be_kind_of Rgentpl::Configuration
    end
  end

  context '#configure' do
    before :each do
      Rgentpl.configure do |config|
        config.new_amazing_key = 'some value'
        config.active          = false
      end
    end

    describe 'can be configured with a block' do
      it 'adding a new attribute' do
        expect(Rgentpl.config.new_amazing_key).to eq 'some value'
      end

      it 'updating and existing one' do
        expect(Rgentpl.config.active).to be_falsey
      end
    end
  end

  describe '.config' do
    it 'an alias of Rgentpl.config' do
      Rgentpl.config.active = false
      expect(Rgentpl.config.to_hash).to eq @configuration.config.to_hash
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rgentpl-1.0.9 spec/lib/rgentpl/core/configuration_spec.rb
rgentpl-1.0.8 spec/lib/rgentpl/core/configuration_spec.rb
rgentpl-1.0.7 spec/lib/rgentpl/core/configuration_spec.rb
rgentpl-1.0.6 spec/lib/rgentpl/core/configuration_spec.rb
rgentpl-1.0.5 spec/lib/rgentpl/core/configuration_spec.rb