class Object

Constants

MFaker

Public Instance Methods

generate_photo_attributes(count=1, attrs={}) click to toggle source
# File lib/polygallery/factories/polygallery/galleries.rb, line 17
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
get_random_photo() click to toggle source
# File lib/polygallery/factories.rb, line 3
def get_random_photo
  photos_dir = Rails.root.join 'spec', 'upload_files'
  raise "No test files found at #{photos_dir}." unless File.exists? photos_dir
  Dir.glob(photos_dir.join('*.{jpg,png,gif}')).sample
end