osem-fcy/spec/factories/sponsors.rb
2018-04-04 10:28:10 -07:00

20 lines
463 B
Ruby

# frozen_string_literal: true
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :sponsor do
name { Faker::Company.name }
website_url { Faker::Internet.url }
description { Faker::Lorem.paragraph }
sponsorship_level
after(:create) do |sponsor|
File.open("spec/support/logos/#{rand(1..13)}.png") do |file|
sponsor.picture = file
end
sponsor.save!
end
end
end