Sha256: 08f84fa6b2e850e17aed671b6ae3c0c74545cfb47a0a166b29f675019e3fbeca

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'

require 'minitest/autorun'
require_relative 'test_helper'
require 'fileutils'

class ChefPackageTest < MiniTest::Unit::TestCase
  include FileUtils

  def setup
    Opsk::Root.start ['generate_chef', 'foo', 'bar']
    Dir.mkdir('foo-sandbox/cookbooks')
    FileUtils.touch('foo-sandbox/cookbooks/1')

  end

  def teardown 
    rm_rf 'foo-sandbox'
  end

  def with_cwd(dir)
    Dir.chdir dir do
	yield  
    end
  end

  def test_build
    with_cwd 'foo-sandbox' do
	Opsk::Root.start ['package']
    end
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/Cheffile')
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/roles/foo.rb')
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/boot.sh')
    assert Dir.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/cookbooks')
    assert Dir.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/environments')
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/dna.json')
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/environments/dev.rb')
    assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opskeleton-0.5.3 test/chef_package_test.rb