Sha256: 208a127a298b8330591e0dee48a99ee954f48d6ee9126af59a6310a1224efbeb

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 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|
    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

4 entries across 4 versions & 1 rubygems

Version Path
gemsmith-6.2.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-6.1.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-6.0.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt
gemsmith-5.6.0 lib/gemsmith/templates/%gem_name%/spec/support/kit/temp_dir.rb.tt