Renamed Factory#name to Factory#factory_name so you can have name attributes without using #add_attribute

This commit is contained in:
Joe Ferris 2008-06-23 18:17:01 -04:00
parent 51ef8f90da
commit d63ed8fa34
2 changed files with 6 additions and 6 deletions

View File

@ -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.
@ -61,13 +61,13 @@ class Factory
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 = {}

View File

@ -82,8 +82,8 @@ class FactoryTest < Test::Unit::TestCase
@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