Sha256: 36121f911184128ef0d977a8e53b3c7bd5c4c7b120e5141644db480ededb5d89

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'fileutils'
require 'pathname'
require 'tmpdir'

describe 'Chake' do
  include FileUtils

  def sh(*args)
    cmd = Shellwords.join(args)
    lib = [Pathname.new(__FILE__).parent.parent / 'lib', ENV.fetch('RUBYLIB', nil)].compact.join(':')
    path = [Pathname.new(__FILE__).parent.parent / 'bin', ENV.fetch('PATH', nil)].join(':')
    env = {
      'RUBYLIB' => lib,
      'PATH' => path
    }
    unless system(env, *args, out: ['.out', 'w'], err: ['.err', 'w'])
      out = File.read('.out')
      err = File.read('.err')
      raise "Command [#{cmd}] failed with exit status #{$CHILD_STATUS} (PATH = #{path}, RUBYLIB = #{lib}).\nstdout:\n#{out}\nstderr:\n#{err}"
    end
    rm_f '.log'
  end

  def chake(*args)
    cmd = [Gem.ruby, '-S', 'chake'] + args
    sh(*cmd)
  end

  def rake(*args)
    cmd = [Gem.ruby, '-S', 'rake'] + args
    sh(*cmd)
  end

  def project
    Dir.mktmpdir do |dir|
      Dir.chdir(dir) do
        yield dir
      end
    end
  end

  it 'loads node information' do
    project do
      chake 'init'
      rake 'nodes'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chake-0.91 spec/integration_tests_spec.rb
chake-0.90.3 spec/integration_tests_spec.rb
chake-0.90.2 spec/integration_tests_spec.rb