include ActionDispatch::TestProcess

FactoryGirl.define do
  factory :photograph do
    transient do
      fake_image_folder 'robots'
    end

    camera_model { Faker::Commerce.product_name }
    captured_at { Faker::Time.between(10.days.ago, Date.today) }

    image { FakerX::Attachment.image(folder=fake_image_folder) }
    image_fingerprint { Time.current.getutc.to_f.to_s }

    trait :with_caption do
      caption { Faker::Lorem.paragraph }
    end

    trait :with_coordinates do
      latitude { Faker::Address.latitude }
      longitude { Faker::Address.longitude }
      altitude { rand * (1000) + 10 }
    end

    trait :with_random_location do
      city { Faker::Address.city }
      country { Faker::Address.country }
    end

  end
end
