X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Funit%2Ffacter%2Futil%2Fpuppet_settings_spec.rb;fp=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Funit%2Ffacter%2Futil%2Fpuppet_settings_spec.rb;h=05dff893fa6f959c829c21313c7b67549c90b29d;hb=131e09855e065be940e104d9ab0f18940cc76257;hp=c278b79849f019aee604f50bd1be20075c15677e;hpb=407d322498f4fde815abf381007fbecfe5c10b2b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb b/3rdparty/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb old mode 100755 new mode 100644 index c278b7984..05dff893f --- a/3rdparty/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb +++ b/3rdparty/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb @@ -1,35 +1,34 @@ -#! /usr/bin/env ruby -S rspec require 'spec_helper' require 'facter/util/puppet_settings' describe Facter::Util::PuppetSettings do - - describe "#with_puppet" do - context "Without Puppet loaded" do + describe '#with_puppet' do + context 'without Puppet loaded' do before(:each) do - Module.expects(:const_get).with("Puppet").raises(NameError) + allow(Module).to receive(:const_get).with('Puppet').and_raise(NameError) end - it 'should be nil' do + it 'is nil' do expect(subject.with_puppet { Puppet[:vardir] }).to be_nil end - it 'should not yield to the block' do - Puppet.expects(:[]).never + it 'does not yield to the block' do + expect(Puppet).to receive(:[]).never expect(subject.with_puppet { Puppet[:vardir] }).to be_nil end end - context "With Puppet loaded" do + context 'with Puppet loaded' do + # module Puppet module Puppet; end - let(:vardir) { "/var/lib/puppet" } + let(:vardir) { '/var/lib/puppet' } before :each do - Puppet.expects(:[]).with(:vardir).returns vardir + allow(Puppet).to receive(:[]).with(:vardir).and_return(vardir) end - it 'should yield to the block' do + it 'yields to the block' do subject.with_puppet { Puppet[:vardir] } end - it 'should return the nodes vardir' do + it 'returns the nodes vardir' do expect(subject.with_puppet { Puppet[:vardir] }).to eq vardir end end