Sha256: 24a571a2c7f6ecdc2dd460c810038f0ed7f7131397b06c87dbbdbba0dba30205

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 Bytes

Contents

require 'tmpdir'

module HomeDirectoryHelpers
  def with_fake_home_directory
    Dir.mktmpdir do |tmp_directory|
      real_home_directory = ENV['HOME']
      ENV['HOME'] = tmp_directory
      # FIXME: should not create the bin directory, write a feature for
      # behavior when directory is missing.
      Dir.mkdir("#{ENV['HOME']}/bin")
      begin
        yield
      ensure
        ENV['HOME'] = real_home_directory
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alternator-0.0.2 spec/support/home_directory_helpers.rb