Sha256: 867a0ba0b7a8a8ccb1611c50a8c813d9e8c4e0eba6606fd18a9247f04dbb775a

Contents?: true

Size: 1.09 KB

Versions: 20

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

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

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

    it 'returns true when the domain is vagrantup.com' do
      node = { 'domain' => 'bacon.vagrantup.com' }
      expect(described_class.vagrant?(node)).to be true
    end

    it 'returns false when the domain is nil' do
      node = { 'domain' => nil }
      expect(described_class.vagrant?(node)).to be false
    end

    it 'returns false when the domain is not vagrantup.com' do
      node = { 'domain' => 'sethvargo.com' }
      expect(described_class.vagrant?(node)).to be false
    end

    it 'returns true when the vagrant user exists on the system' do
      node = { 'etc' => { 'passwd' => { 'vagrant' => {} } } }
      expect(described_class.vagrant?(node)).to be true
    end

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

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
chef-sugar-ng-4.2.2 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-4.2.1 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-4.2.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-4.1.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-4.0.1 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-4.0.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.6.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.5.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.4.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.3.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.2.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.1.1 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.1.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.0.1 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-3.0.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-2.5.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-2.4.1 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-2.4.0 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-2.3.2 spec/unit/chef/sugar/vagrant_spec.rb
chef-sugar-2.3.1 spec/unit/chef/sugar/vagrant_spec.rb