Consolidate errors into factory.rb

This commit is contained in:
Joshua Clayton 2011-11-19 16:37:42 -05:00
parent 9472a14467
commit c46c090bdc
3 changed files with 9 additions and 9 deletions

View File

@ -34,6 +34,15 @@ module FactoryGirl
# Raised when a factory is defined with the same name as a previously-defined factory.
class DuplicateDefinitionError < RuntimeError; end
# Raised when calling Factory.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
def self.factories
@factories ||= Registry.new("Factory")
end

View File

@ -4,12 +4,6 @@ require "factory_girl/attribute/association"
require "factory_girl/attribute/sequence"
module FactoryGirl
# 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
class Attribute #:nodoc:
include Comparable

View File

@ -1,8 +1,5 @@
module FactoryGirl
# Raised when calling Factory.sequence from a dynamic attribute block
class SequenceAbuseError < StandardError; end
# Sequences are defined using sequence within a FactoryGirl.define block.
# Sequence values are generated using next.
class Sequence