Class: FactoryGirl::DisallowsDuplicatesRegistry
- Inherits:
-
Object
- Object
- FactoryGirl::DisallowsDuplicatesRegistry
- Defined in:
- lib/factory_girl/disallows_duplicates_registry.rb
Instance Method Summary (collapse)
-
- (DisallowsDuplicatesRegistry) initialize(component)
constructor
A new instance of DisallowsDuplicatesRegistry.
- - (Object) register(name, item)
Constructor Details
- (DisallowsDuplicatesRegistry) initialize(component)
A new instance of DisallowsDuplicatesRegistry
3 4 5 |
# File 'lib/factory_girl/disallows_duplicates_registry.rb', line 3 def initialize(component) @component = component end |
Instance Method Details
- (Object) register(name, item)
9 10 11 12 13 14 15 |
# File 'lib/factory_girl/disallows_duplicates_registry.rb', line 9 def register(name, item) if registered?(name) raise DuplicateDefinitionError, "#{@component.name} already registered: #{name}" else @component.register(name, item) end end |