lib/fabricators/definitions.rb in fabricators-0.0.4 vs lib/fabricators/definitions.rb in fabricators-0.1.0
- old
+ new
@@ -1,40 +1,25 @@
module Fabricators
class Definitions
- include Callbacks
-
+
def initialize
reset
end
def reset
@fabricators = {}
- @attributes = {}
- @callbacks = {}
end
-
+
def fabricator(name, options={}, &block)
fabricator = Fabricator.new(name, options, &block)
iterate_names name, options do |name|
@fabricators[name] = fabricator
end
end
-
- def attribute(name, options={}, &block)
- attribute = Attribute.new(&block)
- iterate_names name, options do |name|
- @attributes[name] = attribute
- end
- end
- def find(name, type)
- case type
- when :fabricator
- @fabricators[name]
- when :attribute
- @attributes[name]
- end.tap do |definition|
- raise "Definition #{name} of type #{type} not found" unless definition
+ def find(name)
+ @fabricators[name].tap do |definition|
+ raise "Definition #{name} not found" unless definition
end
end
protected