Module: Puppet::Util::Platform
- Defined in:
- lib/rspec-puppet/monkey_patches.rb
Overview
Allow rspec-puppet to pretend to be different platforms.
Class Method Summary collapse
- .actual_platform ⇒ Object
- .pretend_platform ⇒ Object
- .pretend_to_be(platform) ⇒ Object
- .pretend_windows? ⇒ Boolean
- .windows? ⇒ Boolean
Class Method Details
.actual_platform ⇒ Object
89 90 91 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 89 def actual_platform @actual_platform ||= !!File::ALT_SEPARATOR ? :windows : :posix end |
.pretend_platform ⇒ Object
108 109 110 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 108 def pretend_platform @pretend_platform ||= nil end |
.pretend_to_be(platform) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 99 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? ⇒ Boolean
94 95 96 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 94 def pretend_windows? pretend_platform == :windows end |
.windows? ⇒ Boolean
84 85 86 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 84 def windows? pretend_platform.nil? ? (actual_platform == :windows) : pretend_windows? end |