lib/pickle/adapter.rb in pickle-0.4.11 vs lib/pickle/adapter.rb in pickle-0.5.0

- old
+ new

@@ -93,15 +93,11 @@ @name = @klass.name.underscore.gsub('/','_') @name = "#{@blueprint}_#{@name}" unless @blueprint == :master end def create(attrs = {}) - if @klass.respond_to?('make!') - @klass.send(:make!, @blueprint, attrs) - else - @klass.send(:make, @blueprint, attrs) - end + @klass.send(:make!, @blueprint, attrs) end end # factory-girl adapter class FactoryGirl < Adapter @@ -134,12 +130,12 @@ # fabrication adapter class Fabrication < Adapter def self.factories if defined? ::Fabrication - ::Fabrication::Support.find_definitions if ::Fabrication::Fabricator.schematics.empty? - ::Fabrication::Fabricator.schematics.collect{|v| new(v)} + ::Fabrication.manager.load_definitions if ::Fabrication.manager.schematics.empty? + ::Fabrication.manager.schematics.map { |name, klass| new([name, klass]) } else [] end end @@ -149,12 +145,10 @@ end end def create(attrs = {}) if defined? ::Fabrication - ::Fabrication::Fabricator.generate(@name.to_sym, { - :save => true - }, attrs) + Fabricate(@name.to_sym, attrs) end end end # ORM adapter. If you have no factory adapter, you can use this adapter to