Class: Pickle::Adapter::FactoryGirl

Inherits:
Pickle::Adapter show all
Defined in:
lib/pickle/adapter.rb

Overview

factory-girl adapter

Instance Attribute Summary

Attributes inherited from Pickle::Adapter

#klass, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pickle::Adapter

column_names, create_model, find_all_models, find_first_model, get_model, model_classes

Constructor Details

#initialize(factory) ⇒ FactoryGirl

Returns a new instance of FactoryGirl.



112
113
114
# File 'lib/pickle/adapter.rb', line 112

def initialize(factory)
  @klass, @name = factory.build_class, factory.factory_name.to_s
end

Class Method Details

.factoriesObject



108
109
110
# File 'lib/pickle/adapter.rb', line 108

def self.factories
  (::Factory.factories.values rescue []).map {|factory| new(factory)}
end

Instance Method Details

#create(attrs = {}) ⇒ Object



116
117
118
# File 'lib/pickle/adapter.rb', line 116

def create(attrs = {})
  Factory(@name, attrs)
end