Sha256: d3bc4553ceefb355c40b771ec7563e23b755feb07a310bc0f81213739acd4a6e

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

require 'spec'
require 'rubygems'

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

Spec::Runner.configure do |config|
  
end

module Shenandoah
  module Spec
    module Tmpfile
      attr_accessor :tmpdir

      def tmpfile(name, contents="contents not important")
        n = "#{tmpdir}/#{name}"
        FileUtils.mkdir_p File.dirname(n)
        File.open(n, 'w') { |f| f.write contents }
        n
      end

      def self.included(klass)
        klass.class_eval do
          before do
            FileUtils.mkdir_p(self.tmpdir = File.dirname(__FILE__) + "/tmp")
          end

          after do
            FileUtils.rm_r self.tmpdir
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shenandoah-0.0.0 spec/spec_helper.rb