Sha256: c1df43767fb3f8a124aa99b00870fb577b4146b49fcec405fbd881833fdf5d37

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require "rspec/core/shared_context"

module RSpec
  module Kit
    # Adds temp directory support to specs enabled with the :temp_dir metadata key.
    module TempDirContext
      extend RSpec::Core::SharedContext
      let(:temp_dir) { File.expand_path "../../../../tmp/rspec", __FILE__ }
    end
  end
end

RSpec.configure do |config|
  config.include RSpec::Kit::TempDirContext

  config.before do |example|
    if example.metadata[:temp_dir]
      FileUtils.rm_rf(temp_dir) if File.exist?(temp_dir)
      FileUtils.mkdir_p(temp_dir)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gemsmith-5.5.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-5.4.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt