Sha256: d298e9429c7eb4f2d3b64717a4a1800babf17d0d9f96b93943d862c922c2e1a5

Contents?: true

Size: 537 Bytes

Versions: 50

Compression:

Stored size: 537 Bytes

Contents

require 'fileutils'
require 'tmpdir'

shared_context 'isolated environment' do
  around do |example|
    Dir.mktmpdir do |tmpdir|
      original_home = ENV['HOME']

      begin
        virtual_home = File.expand_path(File.join(tmpdir, 'home'))
        Dir.mkdir(virtual_home)
        ENV['HOME'] = virtual_home

        working_dir = File.join(tmpdir, 'work')
        Dir.mkdir(working_dir)

        Dir.chdir(working_dir) do
          example.run
        end
      ensure
        ENV['HOME'] = original_home
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 3 rubygems

Version Path
scss_lint-0.45.0 spec/support/isolated_environment.rb
scss_lint-0.44.0 spec/support/isolated_environment.rb
scss_lint-0.43.2 spec/support/isolated_environment.rb
scss_lint-0.43.1 spec/support/isolated_environment.rb
scss_lint-0.43.0 spec/support/isolated_environment.rb
scss_lint-0.42.2 spec/support/isolated_environment.rb
scss_lint-0.42.1 spec/support/isolated_environment.rb
scss_lint-0.42.0 spec/support/isolated_environment.rb
scss_lint-0.41.0 spec/support/isolated_environment.rb
scss_lint-0.40.1 spec/support/isolated_environment.rb
scss_lint-0.40.0 spec/support/isolated_environment.rb
scss_lint-0.39.0 spec/support/isolated_environment.rb
scss_lint-0.38.0 spec/support/isolated_environment.rb
scss-lint-0.38.0 spec/support/isolated_environment.rb
scss-lint-bliss-1.0.0 spec/support/isolated_environment.rb
scss-lint-0.37.0 spec/support/isolated_environment.rb
scss-lint-0.36.1 spec/support/isolated_environment.rb
scss-lint-0.36.0 spec/support/isolated_environment.rb
scss-lint-0.35.0 spec/support/isolated_environment.rb
scss-lint-0.34.0 spec/support/isolated_environment.rb