Class: FactoryBot::Decorator::DisallowsDuplicatesRegistry

Inherits:
FactoryBot::Decorator show all
Defined in:
lib/factory_bot/decorator/disallows_duplicates_registry.rb

Instance Method Summary collapse

Methods inherited from FactoryBot::Decorator

const_missing, #initialize, #method_missing, #respond_to_missing?, #send

Constructor Details

This class inherits a constructor from FactoryBot::Decorator

Dynamic Method Handling

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

Instance Method Details

#register(name, item) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/factory_bot/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