Skip to content

Commit

Permalink
Make sure a block always exists
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Nov 21, 2011
1 parent c46c090 commit 2bf5cea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/factory_girl/factory.rb
Expand Up @@ -34,6 +34,8 @@ def default_strategy #:nodoc:
end

def run(proxy_class, overrides, &block) #:nodoc:
block ||= lambda {|result| result }

runner_options = {
:attributes => attributes,
:callbacks => callbacks,
Expand All @@ -42,9 +44,7 @@ def run(proxy_class, overrides, &block) #:nodoc:
:proxy_class => proxy_class
}

result = Runner.new(runner_options).run(overrides)

block ? block.call(result) : result
block[Runner.new(runner_options).run(overrides)]
end

def human_names
Expand Down

0 comments on commit 2bf5cea

Please sign in to comment.