Sha256: 34b1a7b194e20fb719f762c5c679cf1fae3347e6afbb12de9c3604259970d0c7

Contents?: true

Size: 859 Bytes

Versions: 15

Compression:

Stored size: 859 Bytes

Contents

module RSpecSystem
  # This object represents a prefab definition from the prefabs.yml file
  class Prefab
    attr_reader :name
    attr_reader :description
    attr_reader :facts
    attr_reader :provider_specifics

    # Return prefab object based on name
    def self.prefab(name)
      prefabs = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'resources', 'prefabs.yml'))
      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

    def initialize(options = {})
      @name = options[:name]
      @description = options[:description]
      @facts = options[:facts]
      @provider_specifics = options[:provider_specifics]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rspec-system-1.3.0 lib/rspec-system/prefab.rb
rspec-system-1.2.1 lib/rspec-system/prefab.rb
rspec-system-1.2.0 lib/rspec-system/prefab.rb
rspec-system-1.1.0 lib/rspec-system/prefab.rb
rspec-system-1.0.0 lib/rspec-system/prefab.rb
rspec-system-0.3.6 lib/rspec-system/prefab.rb
rspec-system-0.3.5 lib/rspec-system/prefab.rb
rspec-system-0.3.4 lib/rspec-system/prefab.rb
rspec-system-0.3.3 lib/rspec-system/prefab.rb
rspec-system-0.3.2 lib/rspec-system/prefab.rb
rspec-system-0.3.1 lib/rspec-system/prefab.rb
rspec-system-0.3.0 lib/rspec-system/prefab.rb
rspec-system-0.2.0 lib/rspec-system/prefab.rb
rspec-system-0.1.5 lib/rspec-system/prefab.rb
rspec-system-0.1.4 lib/rspec-system/prefab.rb