osem-fcy/spec/factories/sponsors.rb

35 lines
803 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-02-20 09:57:27 -08:00
# == Schema Information
#
# Table name: sponsors
#
# id :bigint not null, primary key
# description :text
# logo_file_name :string
# name :string
# picture :string
# website_url :string
# created_at :datetime
# updated_at :datetime
# conference_id :integer
# sponsorship_level_id :integer
#
2014-06-05 17:51:22 +05:30
FactoryBot.define do
2014-06-05 17:51:22 +05:30
factory :sponsor do
2016-04-30 17:56:23 +02:00
name { Faker::Company.name }
website_url { Faker::Internet.url }
2016-05-02 17:39:06 +02:00
description { Faker::Lorem.paragraph }
2016-04-30 17:56:23 +02:00
2014-06-05 17:51:22 +05:30
sponsorship_level
2016-04-27 17:34:17 +02:00
after(:create) do |sponsor|
File.open("spec/support/logos/#{1 + rand(13)}.png") do |file|
sponsor.picture = file
end
sponsor.save!
2016-04-27 17:34:17 +02:00
end
2014-06-05 17:51:22 +05:30
end
end