Sha256: 6835f442e8ab778ecafc95ba5d022a028f98833913a02ddf9efd4143057c9961

Contents?: true

Size: 1.88 KB

Versions: 28

Compression:

Stored size: 1.88 KB

Contents

require "#{File.dirname(__FILE__)}/../../../test_helper"

include_fixture_resources

class ExecResourceTest < Test::Unit::TestCase
  context "Base" do
    setup do      
      PoolParty::Resource.define_resource_methods
      @res = PoolParty::Resources::Exec.new "/usr/sbin/mail -s 'hi' arilerner@mac.com"
      @base = DependencyResolvers::Chef
      @base.compile_directory = test_dir
      
      @str = <<-EOE
execute "/usr/sbin/mail -s 'hi' arilerner@mac.com" do
  command "/usr/sbin/mail -s 'hi' arilerner@mac.com"
  path [ "/usr/bin:/bin:/usr/local/bin:$PATH" ]
  action :run
EOE
    end
    
    should "have the method denoted by has_method_name turn into the string without any modifications" do      
      assert_equal "#{@str}end".chomp, @res.compile(:chef)
    end
    
    should "have the creates method when it's set" do
      @res.creates = "/etc/poolparty/created"
      @str << '  creates "/etc/poolparty/created"'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
    
    should "have the cwd method when it's set" do
      @res.cwd = "/var/poolparty"
      @str << '  cwd "/var/poolparty"'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
    
    should "have the environment method when it's set" do
      @res.environment = :development
      @str << '  environment :development'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
    
    should "have the group method when it's set" do
      @res.group = 501
      @str << '  group 501'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
    
    should "have the returns method when it's set" do
      @res.returns = 1
      @str << '  returns 1'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
    
    should "have the user method when it's set" do
      @res.user = 502
      @str << '  user 502'
      assert_equal "#{@str}\nend", @res.compile(:chef)
    end
  end
  
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.1 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.10 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.11 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.12 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.13 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.14 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.15 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.16 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.17 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.2 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.3 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.4 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.5 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.6 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.7 test/lib/poolparty/resources/exec_test.rb
auser-poolparty-1.3.8 test/lib/poolparty/resources/exec_test.rb
fairchild-poolparty-1.3.17 test/lib/poolparty/resources/exec_test.rb
fairchild-poolparty-1.3.5 test/lib/poolparty/resources/exec_test.rb
poolparty-1.3.15 test/lib/poolparty/resources/exec_test.rb