Class: FactoryGirl::Decorator::DisallowsDuplicatesRegistry

Inherits:
FactoryGirl::Decorator show all
Defined in:
lib/factory_girl/decorator/disallows_duplicates_registry.rb

Instance Method Summary collapse

Methods inherited from FactoryGirl::Decorator

const_missing, #initialize, #method_missing, #send

Constructor Details

This class inherits a constructor from FactoryGirl::Decorator

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FactoryGirl::Decorator

Instance Method Details

#register(name, item) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/factory_girl/decorator/disallows_duplicates_registry.rb', line 4

def register(name, item)
  if registered?(name)
    raise DuplicateDefinitionError, "#{@component.name} already registered: #{name}"
  else
    @component.register(name, item)
  end
end