mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
![Joshua Clayton](/assets/img/avatar_default.png)
This resolves an issue where users have defined methods inside factory girl blocks. This hasn't worked in quite a while and without raising, users would be able to define methods and see an odd error (a NoMethodError for `singleton_method_added=`). Instead, we raise immediately so that no issues come up later when they actually try to use the factories. Closes #513
22 lines
941 B
Ruby
22 lines
941 B
Ruby
module FactoryGirl
|
|
# Raised when a factory is defined that attempts to instantiate itself.
|
|
class AssociationDefinitionError < RuntimeError; end
|
|
|
|
# Raised when a callback is defined that has an invalid name
|
|
class InvalidCallbackNameError < RuntimeError; end
|
|
|
|
# Raised when a factory is defined with the same name as a previously-defined factory.
|
|
class DuplicateDefinitionError < RuntimeError; end
|
|
|
|
# Raised when attempting to register a sequence from a dynamic attribute block
|
|
class SequenceAbuseError < RuntimeError; end
|
|
|
|
# Raised when defining an invalid attribute:
|
|
# * Defining an attribute which has a name ending in "="
|
|
# * Defining an attribute with both a static and lazy value
|
|
# * Defining an attribute twice in the same factory
|
|
class AttributeDefinitionError < RuntimeError; end
|
|
|
|
# Raised when a method is defined in a factory or trait with arguments
|
|
class MethodDefinitionError < RuntimeError; end
|
|
end
|