diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-05 22:57:48 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-05 22:57:48 +0000 |
| commit | 8310c9d18a89e499b63a10e7890d836dcfc86f46 (patch) | |
| tree | 60fcb3ad16dffce1acdb8a4e3088f848cf7b8b2e /test/util/execution.rb | |
| parent | f8254c6a1a080c89608ca98b7fe8e6231a9d213f (diff) | |
| download | puppet-8310c9d18a89e499b63a10e7890d836dcfc86f46.tar.gz puppet-8310c9d18a89e499b63a10e7890d836dcfc86f46.tar.xz puppet-8310c9d18a89e499b63a10e7890d836dcfc86f46.zip | |
Adding a "withenv" execution util method, and using it in :exec for path handling. Next will be other env handling.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1567 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/util/execution.rb')
| -rwxr-xr-x | test/util/execution.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/util/execution.rb b/test/util/execution.rb new file mode 100755 index 000000000..4df606806 --- /dev/null +++ b/test/util/execution.rb @@ -0,0 +1,37 @@ +if __FILE__ == $0 + $:.unshift '..' + $:.unshift '../../lib' + $puppetbase = ".." +end + +require 'puppet' +require 'puppettest' +require 'test/unit' + +class TestPuppetUtilExecution < Test::Unit::TestCase + include TestPuppet + + def test_withenv + ENV["testing"] = "yay" + + assert_nothing_raised do + Puppet::Util::Execution.withenv :testing => "foo" do + $ran = true + end + end + + assert_equal("yay", ENV["testing"]) + assert_equal(true, $ran) + + ENV["rah"] = "yay" + assert_raise(ArgumentError) do + Puppet::Util::Execution.withenv :testing => "foo" do + raise ArgumentError, "yay" + end + end + + assert_equal("yay", ENV["rah"]) + end +end + +# $Id$ |
