1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/lib/factory_girl/proxy/build.rb
2009-02-17 16:38:44 -05:00

29 lines
577 B
Ruby

class Factory
class Proxy #:nodoc:
class Build < Proxy #:nodoc:
def initialize(klass)
@instance = klass.new
end
def get(attribute)
@instance.send(attribute)
end
def set(attribute, value)
@instance.send(:"#{attribute}=", value)
end
def associate(name, factory, attributes)
set(name, Factory.create(factory, attributes))
end
def association(factory, overrides = {})
Factory.create(factory, overrides)
end
def result
@instance
end
end
end
end