Sha256: 0704f0e4ad357f6b8e13946842eadbd52741f5e683319df3c09301d5661157bd

Contents?: true

Size: 581 Bytes

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
omnibus-8.3.2 spec/support/ohai_helpers.rb
omnibus-8.2.2 spec/support/ohai_helpers.rb
omnibus-8.1.15 spec/support/ohai_helpers.rb
omnibus-8.0.15 spec/support/ohai_helpers.rb
omnibus-8.0.9 spec/support/ohai_helpers.rb
omnibus-7.0.34 spec/support/ohai_helpers.rb
omnibus-7.0.13 spec/support/ohai_helpers.rb
omnibus-7.0.12 spec/support/ohai_helpers.rb
omnibus-6.1.9 spec/support/ohai_helpers.rb
omnibus-6.1.7 spec/support/ohai_helpers.rb
omnibus-6.1.4 spec/support/ohai_helpers.rb
omnibus-6.0.30 spec/support/ohai_helpers.rb
omnibus-6.0.25 spec/support/ohai_helpers.rb
omnibus-6.0.24 spec/support/ohai_helpers.rb
omnibus-6.0.1 spec/support/ohai_helpers.rb
omnibus-5.6.8 spec/support/ohai_helpers.rb
omnibus-5.6.6 spec/support/ohai_helpers.rb
omnibus-5.6.1 spec/support/ohai_helpers.rb
omnibus-5.6.0 spec/support/ohai_helpers.rb
omnibus-5.5.0 spec/support/ohai_helpers.rb