Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't compile unless necessary

  • Loading branch information...
commit ac1df1da3b16367732c54d01b01cd11a1359092c 1 parent a022dda
@joshuaclayton joshuaclayton authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/factory_girl/factory.rb
View
10 lib/factory_girl/factory.rb
@@ -13,6 +13,7 @@ def initialize(name, options = {}) #:nodoc:
@class_name = options[:class]
@default_strategy = options[:default_strategy]
@definition = Definition.new(@name)
+ @compiled = false
inherit_traits(options[:traits] || [])
end
@@ -83,9 +84,12 @@ def names
end
def compile
- parent.defined_traits.each {|trait| define_trait(trait) }
- parent.compile
- @definition.compile
+ unless @compiled
+ parent.defined_traits.each {|trait| define_trait(trait) }
+ parent.compile
+ @definition.compile
+ @compiled = true
+ end
end
def with_traits(traits)
Please sign in to comment.
Something went wrong with that request. Please try again.