Top Level Namespace
- Includes:
- ActionDispatch::TestProcess
Defined Under Namespace
Modules: Paperclip, Polygallery
Classes: AddGalleryTitleToPolyphotos, CreatePolygalleries
Constant Summary
collapse
- MFaker =
defined?(Faker) ? Faker : FFaker
Instance Method Summary
collapse
Instance Method Details
#generate_photo_attributes(count = 1, attrs = {}) ⇒ Object
17
18
19
20
|
# 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 ⇒ Object
3
4
5
6
7
|
# 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
|