Sha256: 5ff4a1e61088aa85e7bc2fcf7d1ce466fe9e9004baf6469faa5a5ae1e37aad01

Contents?: true

Size: 820 Bytes

Versions: 8

Compression:

Stored size: 820 Bytes

Contents

module SpecHelpers
  def reset!
    FileUtils.rm_rf   tmp
    [ home, local ].each do |dir|
      FileUtils.mkdir_p(dir)
    end
  end

  def cd(path, &blk)
    Dir.chdir(path, &blk)
  end

  def cwd(*args)
    Pathname.new(Dir.pwd).join(*args)
  end

  def rm(path)
    FileUtils.rm path
  end

  def rm_r(path)
    FileUtils.rm_r path
  end

  def rm_rf(path)
    FileUtils.rm_rf(path)
  end

  def root
    @root ||= Pathname.new(File.expand_path("../../..", __FILE__))
  end

  def fixtures(*path)
    root.join('spec/fixtures', *path)
  end

  def tmp(*path)
    root.join("tmp", *path)
  end

  def home(*path)
    tmp.join("home", *path)
  end

  def local(*path)
    tmp.join("local", *path)
  end

  def spade_dir(*path)
    home(Spade::SPADE_DIR, *path)
  end

  module_function :root, :tmp, :home, :local
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spade-0.0.8.1 spec/support/path.rb
spade-0.0.7 spec/support/path.rb
spade-0.0.6 spec/support/path.rb
spade-0.0.5 spec/support/path.rb
spade-0.0.4 spec/support/path.rb
spade-0.0.3 spec/support/path.rb
spade-0.0.2 spec/support/path.rb
spade-0.0.1 spec/support/path.rb