Sha256: 502a24ed52029c81d718784c1dc451ddd106a7d9fc3494c806eaebd5537bae8c

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

require './spec/spec_helper.rb'

describe Fog::VcloudDirector::Generators::Compute::ComposeVapp do
  describe '.calculate_fence_mode' do
    [
      {
        :case        => 'default',
        :mode        => nil,
        :parent      => nil,
        :parent_name => nil,
        :expected    => 'isolated'
      },
      {
        :case        => 'prevent isolated when parent',
        :mode        => 'isolated',
        :parent      => 'parent-id',
        :parent_name => nil,
        :expected    => 'bridged'
      },
      {
        :case        => 'keep natRouted when parent',
        :mode        => 'natRouted',
        :parent      => 'parent-id',
        :parent_name => nil,
        :expected    => 'natRouted'
      },
      {
        :case        => 'keep bridged when parent',
        :mode        => 'bridged',
        :parent      => 'parent-id',
        :parent_name => nil,
        :expected    => 'bridged'
      },
      {
        :case        => 'prevent bridged when no parent',
        :mode        => 'bridged',
        :parent      => nil,
        :parent_name => nil,
        :expected    => 'isolated'
      },
      {
        :case        => 'prevent natRouted when no parent',
        :mode        => 'natRouted',
        :parent      => nil,
        :parent_name => nil,
        :expected    => 'isolated'
      },
      {
        :case        => 'prevent isolated when parent_name',
        :mode        => 'isolated',
        :parent      => nil,
        :parent_name => 'parent-name',
        :expected    => 'bridged'
      },
    ].each do |args|
      it args[:case].to_s do
        mode = Fog::VcloudDirector::Generators::Compute::ComposeCommon.send(
          :calculate_fence_mode,
          args[:mode],
          args[:parent],
          args[:parent_name]
        )
        mode.must_equal(args[:expected])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-vcloud-director-0.3.1 spec/vcloud_director/generators/compute/compose_vapp_spec.rb
fog-vcloud-director-0.3.0 spec/vcloud_director/generators/compute/compose_vapp_spec.rb