module FileSpec::Setup

Include this module to automatically switch to a temporary directory before each test.

@example

RSpec.configure do |config|
  config.include FileSpec::Setup
end

Public Class Methods

included(base) click to toggle source
# File lib/file_spec.rb, line 28
def self.included(base)
  base.around :each do |example|
    Dir.mktmpdir do |tmp|
      Dir.chdir tmp do
        example.run
      end
    end
  end
end