source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
File size: 1002 bytes
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper'
3require 'facter/util/puppet_settings'
4
5describe Facter::Util::PuppetSettings do
6
7 describe "#with_puppet" do
8 context "Without Puppet loaded" do
9 before(:each) do
10 Module.expects(:const_get).with("Puppet").raises(NameError)
11 end
12
13 it 'should be nil' do
14 expect(subject.with_puppet { Puppet[:vardir] }).to be_nil
15 end
16 it 'should not yield to the block' do
17 Puppet.expects(:[]).never
18 expect(subject.with_puppet { Puppet[:vardir] }).to be_nil
19 end
20 end
21 context "With Puppet loaded" do
22 module Puppet; end
23 let(:vardir) { "/var/lib/puppet" }
24
25 before :each do
26 Puppet.expects(:[]).with(:vardir).returns vardir
27 end
28
29 it 'should yield to the block' do
30 subject.with_puppet { Puppet[:vardir] }
31 end
32 it 'should return the nodes vardir' do
33 expect(subject.with_puppet { Puppet[:vardir] }).to eq vardir
34 end
35 end
36 end
37end
Note: See TracBrowser for help on using the repository browser.