Sha256: 3fbd8736450eec20ad2acc7aa257020c17915fa5d47ba526dd030fb356dec198

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe <%= app_name.camelize %>::Configuration do
  before :each do
    @configuration = <%= app_name.camelize %>::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 <%= app_name.camelize %>::Configuration object' do
      expect(<%= app_name.camelize %>.config).to be_kind_of <%= app_name.camelize %>::Configuration
    end
  end

  context '#configure' do
    before :each do
      <%= app_name.camelize %>.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(<%= app_name.camelize %>.config.new_amazing_key).to eq 'some value'
      end

      it 'updating and existing one' do
        expect(<%= app_name.camelize %>.config.active).to be_false
      end
    end
  end

  describe '.config' do
    it 'an alias of <%= app_name.camelize %>.config' do
      <%= app_name.camelize %>.config.active = false
      expect(<%= app_name.camelize %>.config.to_hash).to eq @configuration.config.to_hash
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rgentpl-1.0.4 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.0.3 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.0.2 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.0.1 src/spec/lib/%app_name%/core/configuration_spec.rb.tt