1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/lib/factory_bot/errors.rb
Jared Beck bfeec78f29 Raise helpful error block given to association
Closes #1033

> Arguably, association should raise and let the developer know
> they're using it in an unexpected way. I'd love to see a PR for
> that (with a test!), so if you're interested in contributing that,
> please do!
> https://github.com/thoughtbot/factory_girl/issues/1032#issuecomment-329297006

Co-authored-by: Daniel Colson <danieljamescolson@gmail.com>
2018-10-28 19:12:34 -04:00

25 lines
1,009 B
Ruby

module FactoryBot
# 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 attribute twice in the same factory
class AttributeDefinitionError < RuntimeError; end
# Raised when attempting to pass a block to an association definition
class AssociationDefinitionError < RuntimeError; end
# Raised when a method is defined in a factory or trait with arguments
class MethodDefinitionError < RuntimeError; end
# Raised when any factory is considered invalid
class InvalidFactoryError < RuntimeError; end
end