Skip to content

Commit

Permalink
Clean up more method scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Oct 7, 2011
1 parent 39caed0 commit 7f42abe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
16 changes: 8 additions & 8 deletions lib/factory_girl/factory.rb
Expand Up @@ -54,10 +54,6 @@ def allow_overrides?
@attribute_list.overridable?
end

def add_child(factory)
@children << factory unless @children.include?(factory)
end

def define_trait(trait)
@defined_traits << trait
end
Expand Down Expand Up @@ -147,10 +143,6 @@ def to_create(&block)
@to_create_block = block
end

def callbacks
attributes.callbacks
end

def ensure_compiled
compile unless @compiled
end
Expand All @@ -165,8 +157,16 @@ def class_name #:nodoc:
@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

Expand Down
7 changes: 0 additions & 7 deletions spec/factory_girl/factory_spec.rb
Expand Up @@ -161,13 +161,6 @@
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
Expand Down

0 comments on commit 7f42abe

Please sign in to comment.