1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

Use delegation from AS

This commit is contained in:
Joshua Clayton 2011-10-14 22:34:51 -04:00
parent 180eb8bec7
commit 9e88eb10de

View file

@ -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 @@ module FactoryGirl
@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 @@ module FactoryGirl
self
end
def allow_overrides?
@attribute_list.overridable?
end
def define_trait(trait)
@defined_traits << trait
end
@ -132,10 +131,6 @@ module FactoryGirl
compile unless @compiled
end
def declare_attribute(declaration)
@attribute_list.declare_attribute(declaration)
end
protected
def class_name #:nodoc:
@ -174,11 +169,7 @@ module FactoryGirl
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)