Sha256: 14613805c8fee37e1f5a24c50e62d7182645375b113847f5949d1b80f7b074a1

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

module FS
  module SpecHelpers
    
    def self.extended(example_group)
      example_group.use_helper(example_group)
    end

    def self.included(example_group)
      example_group.extend self
    end

    def use_helper(describe_block)
      describe_block.before :each do
        unless @test_dir
          @test_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tmp', 'test'))
          FileUtils.mkdir_p(@test_dir)
          Dir.chdir(@test_dir)
        end
      end

      describe_block.after :each do
        if @test_dir
          FileUtils.rm_r(@test_dir)
          @test_dir = nil
        end
      end
    end
    
  end
end

RSpec.configure do |config|
  config.include FS::SpecHelpers
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fs-0.1.0 spec/support/test_dir_support.rb