Sha256: 86f04364698dbb74af09776cdda609a6b32f96e9dd3c5658c2761567db964cab

Contents?: true

Size: 1.59 KB

Versions: 12

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'
require 'guignol'

describe Guignol::Configuration do
  subject { Object.new.extend(described_class) }
  let(:test_path) { Pathname.new 'tmp/test.yml' }
  let(:result) { subject.configuration }

  shared_examples_for 'loaded config' do
    before do
      ENV['GUIGNOL_YML'] = test_path.to_s
      test_path.open('w') do |io|
        io.write config_data
      end
    end

    after do
      test_path.delete
    end

    it 'should load' do
      test_path.should exist
      result.should be_a_kind_of(Hash)
    end

    it 'loads volumes' do
      result['john-mcfoo'][:volumes].should_not be_empty
    end
  end


  context '(with new hash config)' do
    let(:config_data) {%Q{---
john-mcfoo:
  :domain:              housetripdev.com.
  :uuid:                0BADCODE-1337-1337-1337-00DEADBEEF00
  :flavor_id:           c1.medium
  :image_id:            ami-27013f53
  :key_name:            john
  :security_group_ids:  
    - sg-6e718319
    - sg-12341234
  :volumes: 
    foo-disk:
      :dev: /dev/sdf
      :uuid: 1234
    }}

    it_should_behave_like 'loaded config'
  end


  context '(with old array config)' do
    let(:config_data) {%Q{---
- :name:                john-mcfoo
  :domain:              housetripdev.com.
  :uuid:                0BADCODE-1337-1337-1337-00DEADBEEF00
  :flavor_id:           c1.medium
  :image_id:            ami-27013f53
  :key_name:            john
  :security_group_ids:  
    - sg-6e718319
    - sg-12341234
  :volumes: 
    - :size: 6
      :name: foo-disk
      :dev: /dev/sdf
      :uuid: 1234
    }}

    it_should_behave_like 'loaded config'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
guignol-0.3.16 spec/guignol/configuration_spec.rb
guignol-0.3.15 spec/guignol/configuration_spec.rb
guignol-0.3.14 spec/guignol/configuration_spec.rb
guignol-0.3.13 spec/guignol/configuration_spec.rb
guignol-0.3.12 spec/guignol/configuration_spec.rb
guignol-0.3.10 spec/guignol/configuration_spec.rb
guignol-0.3.9 spec/guignol/configuration_spec.rb
guignol-0.3.8 spec/guignol/configuration_spec.rb
guignol-0.3.7 spec/guignol/configuration_spec.rb
guignol-0.3.6.2 spec/guignol/configuration_spec.rb
guignol-0.3.6.1 spec/guignol/configuration_spec.rb
guignol-0.3.6 spec/guignol/configuration_spec.rb