Sha256: fe4ce2c129e6e3e53f974f0a7629bf8f69335b718d0a5f08b9fd4fd6f7068e7c

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 Bytes

Contents

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:

    attr_reader :name

    def initialize(name)
      @name = name.to_sym

      if @name.to_s =~ /=$/
        attribute_name = $`
        raise AttributeDefinitionError,
          "factory_girl uses 'f.#{attribute_name} value' syntax " +
          "rather than 'f.#{attribute_name} = value'"
      end
    end

    def add_to(proxy)
    end

    def association?
      false
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
factory_girl-2.0.2 lib/factory_girl/attribute.rb
factory_girl-2.0.1 lib/factory_girl/attribute.rb
factory_girl-2.0.0.rc4 lib/factory_girl/attribute.rb
factory_girl-2.0.0.rc3 lib/factory_girl/attribute.rb
factory_girl-2.0.0.rc2 lib/factory_girl/attribute.rb
factory_girl-2.0.0.rc1 lib/factory_girl/attribute.rb
factory_girl-2.0.0.beta5 lib/factory_girl/attribute.rb
factory_girl-2.0.0.beta4 lib/factory_girl/attribute.rb
factory_girl-2.0.0.beta3 lib/factory_girl/attribute.rb