Sha256: fb09fd46b22a95984556823a8d00de55085d19669aa5c5902420b963af0f83b8

Contents?: true

Size: 581 Bytes

Versions: 10

Compression:

Stored size: 581 Bytes

Contents

require 'fauxhai'
require 'omnibus/ohai'

module Omnibus
  module RSpec
    module OhaiHelpers
      #
      # Stub Ohai with the given data.
      #
      def stub_ohai(options = {}, &block)
        ohai = Mash.from_hash(Fauxhai.mock(options, &block).data)
        allow(Ohai).to receive(:ohai).and_return(ohai)

        # If we asked for Windows, we should also specify that magical
        # +File::ALT_SEPARATOR+ variable
        if options[:platform] && options[:platform] == 'windows'
          stub_const('File::ALT_SEPARATOR', '\\')
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
omnibus-5.4.0 spec/support/ohai_helpers.rb
omnibus-5.3.0 spec/support/ohai_helpers.rb
omnibus-5.2.0 spec/support/ohai_helpers.rb
omnibus-5.1.0 spec/support/ohai_helpers.rb
omnibus-5.0.0 spec/support/ohai_helpers.rb
omnibus-4.1.0 spec/support/ohai_helpers.rb
omnibus-4.0.0 spec/support/ohai_helpers.rb
omnibus-4.0.0.rc.2 spec/support/ohai_helpers.rb
omnibus-4.0.0.rc.1 spec/support/ohai_helpers.rb
omnibus-4.0.0.beta.1 spec/support/ohai_helpers.rb