Sha256: 1a46f66156423f74a03e36f1713f0a00218cc7feac846a8cb1efc03d0573c545

Contents?: true

Size: 1.4 KB

Versions: 15

Compression:

Stored size: 1.4 KB

Contents

class Factory

  class Proxy #:nodoc:
    def initialize(klass)
    end

    def get(attribute)
      nil
    end

    def set(attribute, value)
    end

    def associate(name, factory, attributes)
    end

    # Generates an association using the current build strategy.
    #
    # Arguments:
    #   name: (Symbol)
    #     The name of the factory that should be used to generate this
    #     association.
    #   attributes: (Hash)
    #     A hash of attributes that should be overridden for this association.
    #
    # Returns:
    #   The generated association for the current build strategy. Note that
    #   assocaitions are not generated for the attributes_for strategy. Returns
    #   nil in this case.
    #
    # Example:
    #
    #   Factory.define :user do |f|
    #     # ...
    #   end
    #
    #   Factory.define :post do |f|
    #     # ...
    #     f.author {|a| a.association :user, :name => 'Joe' }
    #   end
    #
    #   # Builds (but doesn't save) a Post and a User
    #   Factory.build(:post)
    #
    #   # Builds and saves a User, builds a Post, assigns the User to the 
    #   # author association, and saves the User.
    #   Factory.create(:post)
    #
    def association(name, overrides = {})
      nil
    end

    def method_missing(method, *args, &block)
      get(method)
    end

    def result
      raise NotImplementedError, "Strategies must return a result"
    end
  end

end

Version data entries

15 entries across 15 versions & 8 rubygems

Version Path
BrettRasmussen-factory_girl-1.2.2 lib/factory_girl/proxy.rb
BrettRasmussen-factory_girl-1.2.3 lib/factory_girl/proxy.rb
lacomartincik-factory_girl-1.2.1.1 lib/factory_girl/proxy.rb
masa-iwasaki-factory_girl-1.2.1.1 lib/factory_girl/proxy.rb
qrush-factory_girl-1.2.1.1 lib/factory_girl/proxy.rb
thoughtbot-factory_girl-1.2.0 lib/factory_girl/proxy.rb
thoughtbot-factory_girl-1.2.1 lib/factory_girl/proxy.rb
thoughtbot-factory_girl-1.2.2 lib/factory_girl/proxy.rb
ttilley-factory_girl-1.2.2.1 lib/factory_girl/proxy.rb
ttilley-factory_girl-1.2.2.2 lib/factory_girl/proxy.rb
ttilley-factory_girl-1.2.2 lib/factory_girl/proxy.rb
factory_girl-1.2.0 lib/factory_girl/proxy.rb
factory_girl-1.2.1 lib/factory_girl/proxy.rb
freegenie-factory_girl-1.2.2 lib/factory_girl/proxy.rb
factory_girl-1.2.2 lib/factory_girl/proxy.rb