Sha256: f9754d2ef4f5dfa516fb91a1bc6a88c6608f8aadce33b0f4506dba06a7a03a9c
Contents?: true
Size: 1.28 KB
Versions: 22
Compression:
Stored size: 1.28 KB
Contents
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'minitest/autorun' require_relative 'test_helper' require 'fileutils' class PuppetPackageTest < MiniTest::Unit::TestCase include FileUtils def setup Opsk::Root.start ['generate_puppet', 'foo', 'bar'] FileUtils.touch('foo-sandbox/Gemfile.lock') FileUtils.mkdir('foo-sandbox/modules') 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/Puppetfile') assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/manifests/site.pp') assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1/scripts/run.sh') assert File.exists?('foo-sandbox/pkg/foo-sandbox-0.0.1.tar.gz') end def test_script_override File.open('foo-sandbox/opsk.yaml', 'a') do |file| file.puts ' - scripts' end Dir.mkdir('foo-sandbox/scripts/') File.open('foo-sandbox/scripts/run.sh', 'w') { |f| f.write('my script') } with_cwd 'foo-sandbox' do Opsk::Root.start ['package'] end File.open('foo-sandbox/pkg/foo-sandbox-0.0.1/scripts/run.sh', 'r') { |f| assert_equal(f.read , 'my script') } end end
Version data entries
22 entries across 22 versions & 1 rubygems