Sha256: f4ac933c3f4d50f4ce688104d8a0ef59e3d54fecd30a475115c258fa957f65de
Contents?: true
Size: 1.8 KB
Versions: 15
Compression:
Stored size: 1.8 KB
Contents
#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Type.type(:exec).provider(:shell), :unless => Puppet.features.microsoft_windows? do let :resource do Puppet::Resource.new(:exec, 'foo') end let :provider do described_class.new(resource) end describe "#run" do it "should be able to run builtin shell commands" do output, status = provider.run("if [ 1 = 1 ]; then echo 'blah'; fi") status.exitstatus.should == 0 output.should == "blah\n" end it "should be able to run commands with single quotes in them" do output, status = provider.run("echo 'foo bar'") status.exitstatus.should == 0 output.should == "foo bar\n" end it "should be able to run commands with double quotes in them" do output, status = provider.run('echo "foo bar"') status.exitstatus.should == 0 output.should == "foo bar\n" end it "should be able to run multiple commands separated by a semicolon" do output, status = provider.run("echo 'foo' ; echo 'bar'") status.exitstatus.should == 0 output.should == "foo\nbar\n" end it "should be able to read values from the environment parameter" do resource[:environment] = "FOO=bar" output, status = provider.run("echo $FOO") status.exitstatus.should == 0 output.should == "bar\n" end it "#14060: should interpolate inside the subshell, not outside it" do resource[:environment] = "foo=outer" output, status = provider.run("foo=inner; echo \"foo is $foo\"") status.exitstatus.should == 0 output.should == "foo is inner\n" end end describe "#validatecmd" do it "should always return true because builtins don't need path or to be fully qualified" do provider.validatecmd('whateverdoesntmatter').should == true end end end
Version data entries
15 entries across 15 versions & 2 rubygems