File: execution.rb

package info (click to toggle)
puppet 2.6.2-5%2Bsqueeze9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 13,728 kB
  • ctags: 8,726
  • sloc: ruby: 110,196; sh: 934; lisp: 263; xml: 122; sql: 103; makefile: 90; python: 84
file content (33 lines) | stat: -rwxr-xr-x 663 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../lib/puppettest'

require 'puppet'
require 'puppettest'

class TestPuppetUtilExecution < Test::Unit::TestCase
  include PuppetTest

  def test_withenv
    ENV["testing"] = "yay"

    assert_nothing_raised do
      Puppet::Util::Execution.withenv :testing => "foo" do
        $ran = ENV["testing"]
      end
    end

    assert_equal("yay", ENV["testing"])
    assert_equal("foo", $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