mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Clean up more method scoping
This commit is contained in:
parent
39caed08c7
commit
7f42abe6be
2 changed files with 8 additions and 15 deletions
|
@ -54,10 +54,6 @@ module FactoryGirl
|
|||
@attribute_list.overridable?
|
||||
end
|
||||
|
||||
def add_child(factory)
|
||||
@children << factory unless @children.include?(factory)
|
||||
end
|
||||
|
||||
def define_trait(trait)
|
||||
@defined_traits << trait
|
||||
end
|
||||
|
@ -147,10 +143,6 @@ module FactoryGirl
|
|||
@to_create_block = block
|
||||
end
|
||||
|
||||
def callbacks
|
||||
attributes.callbacks
|
||||
end
|
||||
|
||||
def ensure_compiled
|
||||
compile unless @compiled
|
||||
end
|
||||
|
@ -165,8 +157,16 @@ module FactoryGirl
|
|||
@class_name || (parent && parent.class_name) || name
|
||||
end
|
||||
|
||||
def add_child(factory)
|
||||
@children << factory unless @children.include?(factory)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def callbacks
|
||||
attributes.callbacks
|
||||
end
|
||||
|
||||
def compile
|
||||
inherit_factory(parent) if parent
|
||||
|
||||
|
|
|
@ -161,13 +161,6 @@ describe FactoryGirl::Factory do
|
|||
end
|
||||
end
|
||||
|
||||
it "inherits callbacks" do
|
||||
@factory.add_callback(:after_stub) { |object| object.name = 'Stubby' }
|
||||
child = FactoryGirl::Factory.new(:child, :parent => @factory.name)
|
||||
child.ensure_compiled
|
||||
child.callbacks.should_not be_empty
|
||||
end
|
||||
|
||||
it "compiles when looking for attributes" do
|
||||
@factory.declare_attribute(FactoryGirl::Declaration::Static.new("name", "value"))
|
||||
@factory.attributes.size.should == 1
|
||||
|
|
Loading…
Reference in a new issue