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
- .old_windows? ⇒ Object
- .pretend_platform ⇒ Object
- .pretend_to_be(platform) ⇒ Object
- .pretend_windows? ⇒ Boolean
- .windows? ⇒ Boolean
Class Method Details
.actual_platform ⇒ Object
163 164 165 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 163 def actual_platform @actual_platform ||= !!File::ALT_SEPARATOR ? :windows : :posix end |
.old_windows? ⇒ Object
151 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 151 alias :old_windows? :windows? |
.pretend_platform ⇒ Object
182 183 184 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 182 def pretend_platform @pretend_platform ||= nil end |
.pretend_to_be(platform) ⇒ Object
173 174 175 176 177 178 179 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 173 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
168 169 170 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 168 def pretend_windows? pretend_platform == :windows end |
.windows? ⇒ Boolean
154 155 156 157 158 159 160 |
# File 'lib/rspec-puppet/monkey_patches.rb', line 154 def windows? if RSpec::Puppet.rspec_puppet_example? pretend_platform.nil? ? (actual_platform == :windows) : pretend_windows? else old_windows? end end |