2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2018-09-03 20:48:28 +02:00
|
|
|
# Read about factories at https://github.com/thoughtbot/factory_bot
|
2014-04-30 14:48:20 +02:00
|
|
|
|
2018-09-03 20:44:39 +02:00
|
|
|
FactoryBot.define do
|
2014-04-09 01:32:47 +02:00
|
|
|
factory :conference do
|
2016-04-30 17:56:23 +02:00
|
|
|
title { Faker::Book.title }
|
|
|
|
|
short_title { SecureRandom.urlsafe_base64(4) }
|
|
|
|
|
timezone { Faker::Address.time_zone }
|
2018-03-23 17:13:57 +05:00
|
|
|
start_date { Time.zone.today }
|
2014-07-23 09:08:50 +02:00
|
|
|
end_date { 6.days.from_now }
|
2018-09-08 03:58:50 +02:00
|
|
|
start_hour { 9 }
|
|
|
|
|
end_hour { 20 }
|
|
|
|
|
registration_limit { 0 }
|
|
|
|
|
ticket_layout { 'portrait' }
|
2016-05-02 17:39:06 +02:00
|
|
|
description { Faker::Hipster.paragraph }
|
2017-05-31 18:42:52 +05:30
|
|
|
organization
|
2015-01-12 23:13:10 +02:00
|
|
|
after(:create) do |conference|
|
|
|
|
|
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
|
|
|
|
Role.where(name: 'cfp', resource: conference).first_or_create(description: 'For the members of the CfP team')
|
|
|
|
|
Role.where(name: 'info_desk', resource: conference).first_or_create(description: 'For the members of the Info Desk team')
|
|
|
|
|
Role.where(name: 'volunteers_coordinator', resource: conference).first_or_create(description: 'For the people in charge of volunteers')
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-14 17:33:59 +02:00
|
|
|
factory :full_conference do
|
2016-04-30 17:56:23 +02:00
|
|
|
association :splashpage, factory: :full_splashpage
|
2015-04-14 17:33:59 +02:00
|
|
|
registration_period
|
2016-04-30 17:56:23 +02:00
|
|
|
venue
|
2015-04-14 17:33:59 +02:00
|
|
|
|
2015-11-07 11:43:36 +02:00
|
|
|
after :create do |conference|
|
|
|
|
|
conference.commercials << create(:conference_commercial, commercialable: conference)
|
2016-04-30 17:56:23 +02:00
|
|
|
|
|
|
|
|
# Contact/Program is created by Conference callbacks
|
|
|
|
|
conference.contact.destroy
|
|
|
|
|
conference.contact = create(:contact, conference: conference)
|
|
|
|
|
conference.program.update_attributes(schedule_public: true)
|
|
|
|
|
|
|
|
|
|
create(:cfp, program: conference.program)
|
|
|
|
|
create_list(:track, 2, program: conference.program)
|
|
|
|
|
create_list(:ticket, 3, conference: conference)
|
|
|
|
|
create_list(:room, 3, venue: conference.venue)
|
|
|
|
|
create_list(:lodging, 4, conference: conference)
|
|
|
|
|
|
|
|
|
|
create_list(:sponsorship_level, 3, conference: conference)
|
|
|
|
|
create(:sponsor, sponsorship_level: conference.sponsorship_levels.first, conference: conference)
|
|
|
|
|
create_list(:sponsor, 2, sponsorship_level: conference.sponsorship_levels.second, conference: conference)
|
|
|
|
|
create_list(:sponsor, 3, sponsorship_level: conference.sponsorship_levels.third, conference: conference)
|
|
|
|
|
|
|
|
|
|
create(:question, conferences: [conference])
|
|
|
|
|
|
|
|
|
|
# Logo...
|
2016-05-03 14:13:45 +02:00
|
|
|
File.open('spec/support/logos/OSEM.jpg') do |file|
|
2016-05-03 12:13:23 +02:00
|
|
|
conference.picture = file
|
|
|
|
|
end
|
|
|
|
|
conference.save!
|
2015-04-14 17:33:59 +02:00
|
|
|
end
|
|
|
|
|
end
|
2014-04-09 01:32:47 +02:00
|
|
|
end
|
|
|
|
|
end
|