diff --git a/lib/factory_girl/factory.rb b/lib/factory_girl/factory.rb index f2b6d7306..278588c49 100644 --- a/lib/factory_girl/factory.rb +++ b/lib/factory_girl/factory.rb @@ -1,4 +1,5 @@ require "active_support/core_ext/hash/keys" +require "active_support/core_ext/module/delegation" require "active_support/inflector" module FactoryGirl @@ -18,6 +19,8 @@ def initialize(name, options = {}) #:nodoc: @compiled = false end + delegate :overridable?, :declarations, :declare_attribute, :to => :@attribute_list + def factory_name $stderr.puts "DEPRECATION WARNING: factory.factory_name is deprecated; use factory.name instead." name @@ -37,10 +40,6 @@ def allow_overrides self end - def allow_overrides? - @attribute_list.overridable? - end - def define_trait(trait) @defined_traits << trait end @@ -132,10 +131,6 @@ def ensure_compiled compile unless @compiled end - def declare_attribute(declaration) - @attribute_list.declare_attribute(declaration) - end - protected def class_name #:nodoc: @@ -174,11 +169,7 @@ def compile def inherit_factory(parent) #:nodoc: parent.ensure_compiled - allow_overrides if parent.allow_overrides? - end - - def declarations - @attribute_list.declarations + allow_overrides if parent.overridable? end def define_attribute(attribute)