Sha256: 4134b0f6ec7fec31cb2858ce4921272ac1834675746664c5e8031a5ec198c3e3

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

require 'zeus'

module FolderHelpers
  def write(file, content)
    ensure_folder File.dirname(file)
    File.open(file, 'w'){|f| f.write content }
  end

  def read(file)
    File.read file
  end

  def delete(file)
    `rm #{file}`
  end

  def ensure_folder(folder)
    `mkdir -p #{folder}` unless File.exist?(folder)
  end

  def root
    File.expand_path '../..', __FILE__
  end
end

RSpec.configure do |config|
  config.include FolderHelpers

  config.around do |example|
    folder = File.expand_path("../tmp", __FILE__)
    `rm -rf #{folder}`
    ensure_folder folder
    Dir.chdir folder do
      example.call
    end
    `rm -rf #{folder}`
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zeus-0.4.6 spec/spec_helper.rb
zeus-0.4.5 spec/spec_helper.rb
zeus-0.4.4 spec/spec_helper.rb