Sha256: fb58978b46772b1839f3045c236bae98e90e8602cb5bb478e23c1d5405a1fe62

Contents?: true

Size: 790 Bytes

Versions: 7

Compression:

Stored size: 790 Bytes

Contents

require 'fileutils'

#constants
ROOT    = `pwd`.strip.freeze
SAMPLE  = "#{ROOT}/spec/sample_site".freeze
BUILD   = "#{ROOT}/test_build".freeze

# helper methods
def quiet_stdout
  if QUIET
    begin
      orig_stderr = $stderr.clone
      orig_stdout = $stdout.clone
      $stderr.reopen File.new('/dev/null', 'w')
      $stdout.reopen File.new('/dev/null', 'w')
      retval = yield
    rescue StandardError => e
      $stdout.reopen orig_stdout
      $stderr.reopen orig_stderr
      raise e
    ensure
      $stdout.reopen orig_stdout
      $stderr.reopen orig_stderr
    end
    retval
  else
    yield
  end
end

module Test
  def self.reset
    Dir.chdir(ROOT)
    FileUtils.rm_r(BUILD) if File.directory?(BUILD)
    FileUtils.copy_entry(SAMPLE, BUILD)
    Dir.chdir(BUILD)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wax_tasks-1.1.6 spec/setup.rb
wax_tasks-1.1.5 spec/setup.rb
wax_tasks-1.1.2 spec/setup.rb
wax_tasks-1.1.1 spec/setup.rb
wax_tasks-1.0.2 spec/setup.rb
wax_tasks-1.0.1 spec/setup.rb
wax_tasks-1.0.0 spec/setup.rb