Sha256: b794b100f1fc33dd78391e8518e0421607d4a67be8970a010559efe307b7bffb

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 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

    def ignore
      @ignored = true
      self
    end
    
    def ignored?
      @ignored
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
factory_girl_kibiz0r-2.0.0.beta3 lib/factory_girl/attribute.rb
factory_girl_kibiz0r-2.0.0.beta2 lib/factory_girl/attribute.rb