Last change
on this file since 30960 was 30960, checked in by davidb, 8 years ago |
Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster
|
-
Property svn:executable
set to
*
|
File size:
1002 bytes
|
Line | |
---|
1 | #! /usr/bin/env ruby -S rspec
|
---|
2 | require 'spec_helper'
|
---|
3 | require 'facter/util/puppet_settings'
|
---|
4 |
|
---|
5 | describe 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
|
---|
37 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.