Sha256: 13528047342a0e1684cb46c572cc40afe27b2442c31c45a7ef893a43adb22670

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Chef::Sugar::Virtualization do
  it_behaves_like 'a chef sugar'

  describe '#lxc?' do
    it 'returns true when the machine is a linux contianer' do
      node = { 'virtualization' => { 'system' => 'lxc' } }
      expect(described_class.lxc?(node)).to be true
    end

    it 'returns false when the virtual machine is not lxc' do
      node = { 'virtualization' => { 'system' => 'vbox' } }
      expect(described_class.lxc?(node)).to be false
    end

    it 'returns false when the machine is not virtual' do
      node = {}
      expect(described_class.lxc?(node)).to be false
    end
  end

  describe '#vmware?' do
    it 'returns true when the machine is under vmware' do
      node = { 'virtualization' => { 'system' => 'vmware' } }
      expect(described_class.vmware?(node)).to be true
    end

    it 'returns false when the virtual machine is not under vmware' do
      node = { 'virtualization' => { 'system' => 'vbox' } }
      expect(described_class.vmware?(node)).to be false
    end

    it 'returns false when the machine is not virtual' do
      node = {}
      expect(described_class.vmware?(node)).to be false
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chef-sugar-2.4.1 spec/unit/chef/sugar/virtualization_spec.rb
chef-sugar-2.4.0 spec/unit/chef/sugar/virtualization_spec.rb
chef-sugar-2.3.2 spec/unit/chef/sugar/virtualization_spec.rb
chef-sugar-2.3.1 spec/unit/chef/sugar/virtualization_spec.rb
chef-sugar-2.3.0 spec/unit/chef/sugar/virtualization_spec.rb