Sha256: 7ce20537187d297a46721fe615ebf4ed0594f3dea802e98972e396a8a433fd07

Contents?: true

Size: 1.84 KB

Versions: 3

Compression:

Stored size: 1.84 KB

Contents

require './spec/spec_helper.rb'

describe Fog::Generators::Compute::VcloudDirector::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::Generators::Compute::VcloudDirector::ComposeCommon.send(
          :calculate_fence_mode,
          args[:mode],
          args[:parent],
          args[:parent_name]
        )
        mode.must_equal(args[:expected])
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-vcloud-director-0.2.2 spec/vcloud_director/generators/compute/compose_vapp_spec.rb
fog-vcloud-director-0.2.1 spec/vcloud_director/generators/compute/compose_vapp_spec.rb
fog-vcloud-director-0.2.0 spec/vcloud_director/generators/compute/compose_vapp_spec.rb