Sha256: 13886d0303d3113c977f11fa556996a509a39b234e8a573dee2406cd7e1a299f

Contents?: true

Size: 610 Bytes

Versions: 8

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

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|
    FileUtils.mkdir_p(temp_dir) if example.metadata[:temp_dir]
  end

  config.after do |example|
    FileUtils.rm_rf(temp_dir) if example.metadata[:temp_dir]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gemsmith-7.7.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.6.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.5.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.4.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.3.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.2.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.1.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-7.0.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt