Sha256: df96e03cdd5bbcf07a2eed3c23c502ff0fcedd84995e5473aea5850775dff316

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 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 }

  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

  shared_examples_for 'loaded config' do
    it 'should load' do
      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

6 entries across 6 versions & 1 rubygems

Version Path
guignol-0.3.5.1 spec/guignol/configuration_spec.rb
guignol-0.3.5 spec/guignol/configuration_spec.rb
guignol-0.3.4 spec/guignol/configuration_spec.rb
guignol-0.3.3 spec/guignol/configuration_spec.rb
guignol-0.3.2 spec/guignol/configuration_spec.rb
guignol-0.3.1 spec/guignol/configuration_spec.rb