Sha256: 66c346fda1cdbf68231cf7462753e76ef6cfd5dd0c61d3184b423b30f781a05c

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 Bytes

Contents

# encoding: UTF-8

Dir[File.expand_path('../../factories', __FILE__) + '/*.rb'].each do |factory|
  require factory
end

def Factory.build_via_new(name, attributes = {})
  attributes = Factory.attributes_for(name).merge(attributes)
  klass = FactoryGirl.factory_by_name(name).build_class
  klass.new(attributes)
end

##
# Override the default Factory() create alias method to build the attributes
# hash, then create them all though the new method. This gets around :required
# attribute issues in Hashie objects.
#
def Factory(name, attributes = {})
  Factory.build_via_new(name, attributes).save!
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contactology-0.1.2 spec/support/factory_girl.rb
contactology-0.1.1 spec/support/factory_girl.rb
contactology-0.1.0 spec/support/factory_girl.rb
contactology-0.0.2 spec/support/factory_girl.rb