Sha256: 187b41ae43ca721e34ede4fd38d3274b9054e2eb9980242273644657eecd8eae

Contents?: true

Size: 730 Bytes

Versions: 40

Compression:

Stored size: 730 Bytes

Contents

require "tempfile"

require "unit/support/isolated_environment"

shared_context "unit" do
  # This creates an isolated environment so that Vagrant doesn't
  # muck around with your real system during unit tests.
  #
  # The returned isolated environment has a variety of helper
  # methods on it to easily create files, Vagrantfiles, boxes,
  # etc.
  def isolated_environment
    env = Unit::IsolatedEnvironment.new
    yield env if block_given?
    env
  end

  # This helper creates a temporary file and returns a Pathname
  # object pointed to it.
  def temporary_file(contents=nil)
    f = Tempfile.new("vagrant-unit")

    if contents
      f.write(contents)
      f.flush
    end

    return Pathname.new(f.path)
  end
end

Version data entries

40 entries across 40 versions & 6 rubygems

Version Path
bmhatfield-vagrant-1.0.10 test/unit/support/shared/base_context.rb
bmhatfield-vagrant-1.0.9 test/unit/support/shared/base_context.rb
bmhatfield-vagrant-1.0.8 test/unit/support/shared/base_context.rb
bmhatfield-vagrant-1.0.7 test/unit/support/shared/base_context.rb
vagrantup-1.0.7 test/unit/support/shared/base_context.rb
vagrantup-1.0.6 test/unit/support/shared/base_context.rb
vagrantup-1.0.5 test/unit/support/shared/base_context.rb
vagrantup-1.0.4 test/unit/support/shared/base_context.rb
vagrantup-1.0.3 test/unit/support/shared/base_context.rb
vagrantup-1.0.2 test/unit/support/shared/base_context.rb
vagrantup-1.0.1 test/unit/support/shared/base_context.rb
vagrantup-1.0.0 test/unit/support/shared/base_context.rb
vagrantup-0.9.99.2 test/unit/support/shared/base_context.rb
vagrantup-0.9.99.1 test/unit/support/shared/base_context.rb
vagrantup-0.9.7 test/unit/support/shared/base_context.rb
vagrantup-0.9.6 test/unit/support/shared/base_context.rb
vagrantup-0.9.5 test/unit/support/shared/base_context.rb
vagrantup-0.9.4 test/unit/support/shared/base_context.rb
vagrantup-0.9.3 test/unit/support/shared/base_context.rb
vagrantup-0.9.2 test/unit/support/shared/base_context.rb