Skip to content

Commit

Permalink
Consolidate errors into factory.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Nov 19, 2011
1 parent 9472a14 commit c46c090
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 9 additions & 0 deletions lib/factory_girl.rb
Expand Up @@ -34,6 +34,15 @@ 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 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
Expand Down
6 changes: 0 additions & 6 deletions lib/factory_girl/attribute.rb
Expand Up @@ -4,12 +4,6 @@
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
Expand Down
3 changes: 0 additions & 3 deletions lib/factory_girl/sequence.rb
@@ -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
Expand Down

0 comments on commit c46c090

Please sign in to comment.