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 177
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 182
def actually_windows?
  actual_platform == :windows
end
pretend_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 201
def pretend_platform
  @pretend_platform ||= nil
end
pretend_to_be(platform) click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 192
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 187
def pretend_windows?
  pretend_platform == :windows
end
pretending?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 206
def pretending?
  !pretend_platform.nil?
end
windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 168
def windows?
  if RSpec::Puppet.rspec_puppet_example?
    pretending? ? pretend_windows? : (actual_platform == :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 177
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 182
def actually_windows?
  actual_platform == :windows
end
pretend_platform() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 201
def pretend_platform
  @pretend_platform ||= nil
end
pretend_to_be(platform) click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 192
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 187
def pretend_windows?
  pretend_platform == :windows
end
pretending?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 206
def pretending?
  !pretend_platform.nil?
end
windows?() click to toggle source
# File lib/rspec-puppet/monkey_patches.rb, line 168
def windows?
  if RSpec::Puppet.rspec_puppet_example?
    pretending? ? pretend_windows? : (actual_platform == :windows)
  else
    old_windows?
  end
end
Also aliased as: old_windows?