Sha256: f3d0c6cf54b3489ff3b82ad0a77d00d7147a506ecdccc2d73c6a5259ae400f7b

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

FactoryGirl.define do
  factory :album, class: Refinery::PhotoGallery::Album do
    title { Faker::Lorem::word }
    path "15_04"
    description "describtion about album"
    address "slovakia"

    factory :album_with_photos do
      transient do
        photos_count 5
      end

      # the after(:create) yields two values; the user instance itself and the
      # evaluator, which stores all values from the factory, including transient
      # attributes; `create_list`'s second argument is the number of records
      # to create and we make sure the user is associated properly to the post
      after(:create) do |album, evaluator|
        create_list(:photo, evaluator.photos_count, album: album)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-photo-gallery-0.2.0 spec/factories/albums.rb