module Puppet::Util::Platform

Allow rspec-puppet to pretend to be different platforms.

Public Class Methods

actual_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 190
def actual_platform
  @actual_platform ||= !!File::ALT_SEPARATOR ? :windows : :posix
end
actually_windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 195
def actually_windows?
  actual_platform == :windows
end
pretend_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 214
def pretend_platform
  @pretend_platform ||= nil
end
pretend_to_be(platform) click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 205
def pretend_to_be(platform)
  # Ensure that we cache the real platform before pretending to be
  # a different one
  actual_platform

  @pretend_platform = platform
end
pretend_windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 200
def pretend_windows?
  pretend_platform == :windows
end
pretending?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 219
def pretending?
  !pretend_platform.nil?
end
windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 181
def windows?
  if RSpec::Puppet.rspec_puppet_example?
    !pretending? ? (actual_platform == :windows) : pretend_windows?
  else
    old_windows?
  end
end
Also aliased as: old_windows?

Public Instance Methods

old_windows?()
Alias for: windows?

Private Instance Methods

actual_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 190
def actual_platform
  @actual_platform ||= !!File::ALT_SEPARATOR ? :windows : :posix
end
actually_windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 195
def actually_windows?
  actual_platform == :windows
end
pretend_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 214
def pretend_platform
  @pretend_platform ||= nil
end
pretend_to_be(platform) click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 205
def pretend_to_be(platform)
  # Ensure that we cache the real platform before pretending to be
  # a different one
  actual_platform

  @pretend_platform = platform
end
pretend_windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 200
def pretend_windows?
  pretend_platform == :windows
end
pretending?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 219
def pretending?
  !pretend_platform.nil?
end
windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 181
def windows?
  if RSpec::Puppet.rspec_puppet_example?
    !pretending? ? (actual_platform == :windows) : pretend_windows?
  else
    old_windows?
  end
end
Also aliased as: old_windows?