Sha256: c8aaab5adb26b6737c4cdfdfcaa990f8ee1a8b73fd53388c8f1ff1bd73ea1ee5

Contents?: true

Size: 1.34 KB

Versions: 10

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 an existing one' do
        expect(<%= app_name.camelize %>.config.active).to be_falsey
      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

10 entries across 10 versions & 1 rubygems

Version Path
rgentpl-1.2.6 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.5 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.4.3 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.4.2 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.4.1 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.4 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.3 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.2 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.1 src/spec/lib/%app_name%/core/configuration_spec.rb.tt
rgentpl-1.2.0 src/spec/lib/%app_name%/core/configuration_spec.rb.tt