Skip to content

Commit

Permalink
Renamed Factory#name to Factory#factory_name so you can have name att…
Browse files Browse the repository at this point in the history
…ributes without using #add_attribute
  • Loading branch information
jferris committed Jun 23, 2008
1 parent 51ef8f9 commit d63ed8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/factory_girl/factory.rb
Expand Up @@ -4,7 +4,7 @@ class Factory
self.factories = {}
self.sequences = {}

attr_reader :name
attr_reader :factory_name

# Defines a new factory that can be used by the build strategies (create and
# build) to build new objects.
Expand Down Expand Up @@ -61,13 +61,13 @@ def self.next (sequence)
end

def build_class #:nodoc:
@build_class ||= @options[:class] || name.to_s.classify.constantize
@build_class ||= @options[:class] || factory_name.to_s.classify.constantize
end

def initialize (name, options = {}) #:nodoc:
options.assert_valid_keys(:class)
@name = name
@options = options
@factory_name = name
@options = options

@static_attributes = {}
@lazy_attribute_blocks = {}
Expand Down
4 changes: 2 additions & 2 deletions test/factory_test.rb
Expand Up @@ -82,8 +82,8 @@ def self.should_instantiate_class
@factory = Factory.new(@name)
end

should "have a name" do
assert_equal @name, @factory.name
should "have a factory name" do
assert_equal @name, @factory.factory_name
end

should "have a build class" do
Expand Down

0 comments on commit d63ed8f

Please sign in to comment.