Class: Fauxhai::Mocker

Inherits:
Object
  • Object
show all
Defined in:
lib/fauxhai/mocker.rb

Constant Summary collapse

RAW_BASE =

The base URL for the GitHub project (raw)

'https://raw.githubusercontent.com/chefspec/fauxhai/master'.freeze
PLATFORM_LIST_MESSAGE =

A message about where to find a list of platforms

'A list of available platforms is available at https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|@data| ... } ⇒ Mocker

Create a new Ohai Mock with fauxhai.

Parameters:

  • options (Hash) (defaults to: {})

    the options for the mocker

Options Hash (options):

  • :platform (String)

    the platform to mock

  • :version (String)

    the version of the platform to mock

  • :path (String)

    the path to a local JSON file

  • :github_fetching (Bool)

    whether to try loading from Github

Yields:



28
29
30
31
32
33
34
35
# File 'lib/fauxhai/mocker.rb', line 28

def initialize(options = {}, &override_attributes)
  @options = { github_fetching: true }.merge(options)

  @data = fauxhai_data
  yield(@data) if block_given?

  @data
end

Instance Attribute Details

#dataHash (readonly)

Returns The raw ohai data for the given Mock.

Returns:

  • (Hash)

    The raw ohai data for the given Mock



14
15
16
# File 'lib/fauxhai/mocker.rb', line 14

def data
  @data
end