Sha256: bfcb85cfddfad381810982f30022b104e06161b454a51f374b6285c89250a5e5
Contents?: true
Size: 696 Bytes
Versions: 15
Compression:
Stored size: 696 Bytes
Contents
FactoryGirl.define do # to_create do |instance| # raise "Save failed for #{instance.class} (#{instance.errors.full_messages.inspect})" if !instance.save # end factory :polygallery_gallery, :class => Polygallery::Gallery do title 'gallery' trait :with_photo do photos_attributes { generate_photo_attributes } end trait :with_photos do photos_attributes { generate_photo_attributes 3 } end trait :with_tons_of_photos do photos_attributes { generate_photo_attributes 10 } end end end def generate_photo_attributes(count=1, attrs={}) if count.is_a? Hash; attrs = count; count = 1 end (1..count).map{ attributes_for :polygallery_photo, attrs } end
Version data entries
15 entries across 15 versions & 1 rubygems