Module: FactoryGroup

Defined in:
lib/factory_group.rb,
lib/factory_group/group.rb,
lib/factory_group/version.rb,
lib/factory_group/exceptions/factory_group_not_defined.rb

Defined Under Namespace

Modules: Exceptions Classes: Group

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.create(name) ⇒ Object



18
19
20
21
22
23
# File 'lib/factory_group.rb', line 18

def self.create(name)
  raise Exceptions::FactoryGroupNotDefined if !registry[name]

  factory_group = registry[name].call
  factory_group.factories
end

.define(name, &block) ⇒ Object



12
13
14
15
16
# File 'lib/factory_group.rb', line 12

def self.define(name, &block)
  FactoryGroup.registry[name] = -> {
    Group.new.tap{ |g| g.instance_eval(&block) }
  }
end

.registryObject



8
9
10
# File 'lib/factory_group.rb', line 8

def self.registry
  @registry
end