From 5fc57dacf7504d3dd32f8a092ea258fc34b47236 Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Fri, 2 Dec 2011 10:13:34 -0500 Subject: [PATCH] Pass overrides when constructing Runner --- lib/factory_girl/factory.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/factory_girl/factory.rb b/lib/factory_girl/factory.rb index 863533823..2b21a0af2 100644 --- a/lib/factory_girl/factory.rb +++ b/lib/factory_girl/factory.rb @@ -41,10 +41,11 @@ def run(proxy_class, overrides, &block) #:nodoc: :callbacks => callbacks, :to_create => to_create, :build_class => build_class, - :proxy_class => proxy_class + :proxy_class => proxy_class, + :overrides => overrides.dup } - block[Runner.new(runner_options).run(overrides)] + block[Runner.new(runner_options).run] end def human_names @@ -100,6 +101,7 @@ def with_traits(traits) def class_name #:nodoc: @class_name || parent.class_name || name + end def attributes @@ -150,13 +152,10 @@ def initialize(options = {}) @to_create = options[:to_create] @build_class = options[:build_class] @proxy_class = options[:proxy_class] - - @overrides = {} + @overrides = options[:overrides] end - def run(overrides = {}) - @overrides = overrides.symbolize_keys - + def run apply_attributes apply_remaining_overrides