Sha256: 07a416a7ea24cf9ead8e0bdea1f47bb5d34609dd21d0581a036bc767bb0c1390

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

require 'fileutils'

module FileBuilder
  SPEC_DIR = File.dirname(File.dirname(__FILE__))
  OUTPUT_PATH = File.join(SPEC_DIR, 'built-files')

  def self.create_file(path, &block)
    path_to_created_file = File.join(OUTPUT_PATH, path)
    FileUtils.mkdir_p(File.dirname(path_to_created_file))
    open(path_to_created_file, 'w', &block)
  end

  def self.remove_created_files
    FileUtils.rm_rf(OUTPUT_PATH)
  end
end

RSpec.configure do |config|
  config.after do
    FileBuilder.remove_created_files
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipio-0.0.2 spec/support/file_builder.rb
pipio-0.0.1 spec/support/file_builder.rb