Sha256: 9a94e1066c2ab7dc46d9d735fa7613cd016a2d0ea2bf12abbdee10e46fe2235a

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

require 'spec_helper'

describe Chef::Node do
  describe '#in?' do
    it 'returns true when the node is in the environment' do
      subject.stub(:chef_environment).and_return('production')
      expect(subject.in?('production')).to be_true
      expect(subject.in?(/production$/)).to be_true
    end

    it 'returns false when the node is not in the environment' do
      subject.stub(:chef_environment).and_return('staging')
      expect(subject.in?('production')).to be_false
      expect(subject.in?(/production$/)).to be_false
    end
  end

  describe '#includes_recipe?' do
    it 'returns true when the recipe exists' do
      subject.stub(:run_list).and_return(['recipe[magic::recipe]'])
      expect(subject.includes_recipe?('recipe[magic::recipe]')).to be_true
    end

    it 'returns false when the recipe does
     not exist' do
      subject.stub(:run_list).and_return([])
      expect(subject.includes_recipe?('recipe[magic::recipe]')).to be_false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chef-sugar-1.1.0 spec/unit/chef/extensions/node_spec.rb
chef-sugar-1.0.1 spec/unit/chef/extensions/node_spec.rb
chef-sugar-1.0.0 spec/unit/chef/extensions/node_spec.rb
chef-sugar-1.0.0.beta.1 spec/unit/chef/extensions/node_spec.rb