lib/pickle/adapter.rb in pickle-0.5.3 vs lib/pickle/adapter.rb in pickle-0.5.4

- old
+ new

@@ -1,7 +1,5 @@ -require 'active_support/core_ext' - module Pickle # Abstract Factory adapter class, if you have a factory type setup, you # can easily create an adaptor to make it work with Pickle. # # The factory adaptor must have a #factories class method that returns @@ -98,15 +96,15 @@ @klass.send(:make!, @blueprint, attrs) end end # factory-girl adapter - class FactoryGirl < Adapter + class FactoryBot < Adapter def self.factories - if defined? ::FactoryGirl + if defined? ::FactoryBot factories = [] - ::FactoryGirl.factories.each do |factory| + ::FactoryBot.factories.each do |factory| factory.names.each do |name| factories << new(factory, name) end end factories @@ -114,27 +112,27 @@ (::Factory.factories.values rescue []).map {|factory| new(factory)} end end def initialize(factory, factory_name) - if defined? ::FactoryGirl + if defined? ::FactoryBot @klass, @name = factory.build_class, factory_name.to_s else @klass, @name = factory.build_class, factory.factory_name.to_s end end def create(attrs = {}) - if defined? ::FactoryGirl - ::FactoryGirl.create(@name, attrs) + if defined? ::FactoryBot + ::FactoryBot.create(@name, attrs) else Factory(@name, attrs) end end def build(attrs = {}) - if defined? ::FactoryGirl - ::FactoryGirl.build(@name, attrs) + if defined? ::FactoryBot + ::FactoryBot.build(@name, attrs) else Factory.build(@name, attrs) end end end