Sha256: c63462a215ec80e916487eb594b5214e1a1690d164d1fdab71be424456f0f80a

Contents?: true

Size: 1.53 KB

Versions: 11

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'
require 'guignol/models/instance'

describe Guignol::Models::Instance do
  subject { described_class.new(name, options) }

  let(:name) { "foobar" }
  let(:options) {{
    :uuid => '948DB8E9-A356-4F66-8857-165FBDF5A71F'
  }}

  before(:each) do
    # connection = stub(:servers => [])
    # Fog::Compute.stub(:new).and_return(connection)
  end

  describe '#initialize' do
    it 'should require :uuid' do
      options.delete :uuid
      expect { subject }.to raise_error
    end

    it 'should require a name' do
      name.replace ""
      expect { subject }.to raise_error
    end

    it 'should pass with minimal options' do
      subject
    end

    it 'parses ERB in user data' do
      options[:foo] = 'bar'
      options[:user_data] = "foo=<%= foo %>,<%= name %>"
      subject.options[:user_data].should == 'foo=bar,foobar'
    end
  end


  shared_examples_for 'server setup' do
    it 'set server tags'
    it 'configures DNS properly'
  end


  describe '#create' do
    it 'should pass with minimal options' do
      subject.create
    end

    it 'reuses existing volumes'
    it 'fails when existing volumes are in different zones'

    it 'starts up the server'

    it_should_behave_like 'server setup'
  end


  describe '#start' do
    it_should_behave_like 'server setup'

    it 'returns when the server does not exist' do
      subject.start
    end

    it 'returns with a server marked as "running"'

  end


  describe '#destroy' do
    it 'should pass with minimal options' do
      subject.destroy
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
guignol-0.3.8 spec/guignol/instance_spec.rb
guignol-0.3.7 spec/guignol/instance_spec.rb
guignol-0.3.6.2 spec/guignol/instance_spec.rb
guignol-0.3.6.1 spec/guignol/instance_spec.rb
guignol-0.3.6 spec/guignol/instance_spec.rb
guignol-0.3.5.1 spec/guignol/instance_spec.rb
guignol-0.3.5 spec/guignol/instance_spec.rb
guignol-0.3.4 spec/guignol/instance_spec.rb
guignol-0.3.3 spec/guignol/instance_spec.rb
guignol-0.3.2 spec/guignol/instance_spec.rb
guignol-0.3.1 spec/guignol/instance_spec.rb