lib/rspec-system/node.rb in rspec-system-2.3.0 vs lib/rspec-system/node.rb in rspec-system-2.4.0
- old
+ new
@@ -16,26 +16,29 @@
def self.node_from_yaml(nodeset, k, v, custom_prefabs_path)
RSpecSystem::Node.new(
:nodeset => nodeset,
:custom_prefabs_path => custom_prefabs_path,
:name => k,
- :prefab => v['prefab']
+ :prefab => v['prefab'],
+ :options => v['options']
)
end
# Create a new node object.
#
# @param options [Hash] options for new node
# @option options [String] :name name of node. Mandatory.
# @option options [String] :prefab prefab setting. Mandatory.
+ # @option options [String] :options options setting. Optional.
# @option options [RSpecSystem::NodeSet] :nodeset the parent nodeset for
# this node. Mandatory.
# @option options [String] :custom_prefabs_path path of custom prefabs
# yaml file. Optional.
def initialize(options)
@name = options[:name]
prefab = options[:prefab]
+ @options = options[:options]
@nodeset = options[:nodeset]
@custom_prefabs_path = options[:custom_prefabs_path]
if prefab.nil?
# TODO: do not support not prefabs yet
@@ -57,9 +60,16 @@
# Returns the prefab object for this node (if any).
#
# @return [RSpecSystem::Prefab] the prefab object used to create this node
def prefab
@prefab
+ end
+
+ # Returns the custom object for this node (if any).
+ #
+ # @return [Hash] the options object used to customize the node
+ def options
+ @options
end
# Retreives facts from the nodeset definition or prefab.
#
# @return [Hash] returns a hash of facter facts defined for this node