Class: RSpecSystem::Prefab
- Inherits:
-
Object
- Object
- RSpecSystem::Prefab
- Extended by:
- Util
- Defined in:
- lib/rspec-system/prefab.rb
Overview
This object represents a prefab definition from the prefabs.yml file
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#facts ⇒ Object
readonly
Returns the value of attribute facts.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider_specifics ⇒ Object
readonly
Returns the value of attribute provider_specifics.
Class Method Summary collapse
-
.prefab(name, custom_prefabs_path) ⇒ Object
Return prefab object based on name.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Prefab
constructor
A new instance of Prefab.
Methods included from Util
Constructor Details
#initialize(options = {}) ⇒ Prefab
Returns a new instance of Prefab.
31 32 33 34 35 36 |
# File 'lib/rspec-system/prefab.rb', line 31 def initialize( = {}) @name = [:name] @description = [:description] @facts = [:facts] @provider_specifics = [:provider_specifics] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/rspec-system/prefab.rb', line 7 def description @description end |
#facts ⇒ Object (readonly)
Returns the value of attribute facts.
8 9 10 |
# File 'lib/rspec-system/prefab.rb', line 8 def facts @facts end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rspec-system/prefab.rb', line 6 def name @name end |
#provider_specifics ⇒ Object (readonly)
Returns the value of attribute provider_specifics.
9 10 11 |
# File 'lib/rspec-system/prefab.rb', line 9 def provider_specifics @provider_specifics end |
Class Method Details
.prefab(name, custom_prefabs_path) ⇒ Object
Return prefab object based on name
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rspec-system/prefab.rb', line 12 def self.prefab(name, custom_prefabs_path) if File.exists?(custom_prefabs_path) custom_prefabs = YAML.load_file(custom_prefabs_path) else custom_prefabs = {} end prefabs = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'resources', 'prefabs.yml')) deep_merge!(prefabs, custom_prefabs) raise "No such prefab" unless pf = prefabs[name] RSpecSystem::Prefab.new( :name => name, :description => pf['description'], :facts => pf['facts'], :provider_specifics => pf['provider_specifics'] ) end |