Class: Simmer::Database::FixtureSet

Inherits:
Object
  • Object
show all
Defined in:
lib/simmer/database/fixture_set.rb

Overview

Hydrate a collection of Fixture instances from configuration.

Defined Under Namespace

Classes: FixtureMissingError

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ FixtureSet

Returns a new instance of FixtureSet.



18
19
20
21
22
# File 'lib/simmer/database/fixture_set.rb', line 18

def initialize(config = {})
  @fixtures_by_name = config_to_fixures_by_name(config)

  freeze
end

Instance Method Details

#get!(name) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/simmer/database/fixture_set.rb', line 24

def get!(name)
  key = name.to_s

  raise FixtureMissingError, "fixture missing: #{name}" unless fixtures_by_name.key?(key)

  fixtures_by_name[key]
end