class Pickle::Adapter::Fabrication

fabrication adapter

Public Class Methods

factories() click to toggle source
# File lib/pickle/adapter.rb, line 143
def self.factories
  if defined? ::Fabrication
    ::Fabrication.manager.load_definitions if ::Fabrication.manager.schematics.empty?
    ::Fabrication.manager.schematics.map { |name, klass| new([name, klass]) }
  else
    []
  end
end
new(factory) click to toggle source
# File lib/pickle/adapter.rb, line 152
def initialize(factory)
  if defined? ::Fabrication
    @klass, @name = factory[1].send(:klass), factory[0].to_s
  end
end

Public Instance Methods

create(attrs = {}) click to toggle source
# File lib/pickle/adapter.rb, line 158
def create(attrs = {})
  if defined? ::Fabrication
    Fabricate(@name.to_sym, attrs)
  end
end