jam-cloud/ruby/spec/factories.rb

1170 lines
35 KiB
Ruby
Raw Normal View History

require 'faker'
FactoryGirl.define do
factory :user, :class => JamRuby::User do
transient do
specific_instruments nil
end
2016-06-02 14:04:56 +00:00
sequence(:email) { |n| "person_#{n}@example.com" }
sequence(:first_name) { |n| "Person" }
sequence(:last_name) { |n| "#{n}" }
password "foobar"
password_confirmation "foobar"
2012-11-12 12:28:44 +00:00
email_confirmed true
city "Apex"
state "NC"
country "US"
musician true
2013-03-15 04:22:31 +00:00
terms_of_service true
last_jam_audio_latency 5
2015-03-20 13:48:00 +00:00
reuse_card true
has_redeemable_jamtrack true
gifted_jamtracks 0
remaining_free_lessons 1
remaining_test_drives 0
stored_credit_card false
2013-03-15 04:22:31 +00:00
#u.association :musician_instrument, factory: :musician_instrument, user: u
before(:create) do |user, evaluator|
if evaluator.specific_instruments
evaluator.specific_instruments.each do |instrument|
user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user, instrument: instrument)
end
else
user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user)
end
2013-03-15 04:22:31 +00:00
end
factory :fan do
musician false
end
factory :admin do
admin true
end
2014-01-25 20:03:14 +00:00
2014-09-22 19:20:58 +00:00
factory :austin_user do
first_name 'Austin'
2016-06-02 14:04:56 +00:00
sequence(:last_name) { |n| "#{n}" }
2014-09-22 19:20:58 +00:00
state 'TX'
city 'Austin'
last_jam_locidispid { austin_geoip[:locidispid] }
last_jam_addr { austin_ip }
end
factory :dallas_user do
first_name 'Dallas'
2016-06-02 14:04:56 +00:00
sequence(:last_name) { |n| "#{n}" }
2014-09-22 19:20:58 +00:00
state 'TX'
city 'Dallas'
last_jam_locidispid { dallas_geoip[:locidispid] }
last_jam_addr { dallas_ip }
end
factory :houston_user do
first_name 'Houston'
2016-06-02 14:04:56 +00:00
sequence(:last_name) { |n| "#{n}" }
2014-09-22 19:20:58 +00:00
state 'TX'
city 'Houston'
last_jam_locidispid { houston_geoip[:locidispid] }
last_jam_addr { houston_ip }
end
factory :miami_user do
first_name 'Miami'
2016-06-02 14:04:56 +00:00
sequence(:last_name) { |n| "#{n}" }
2014-09-22 19:20:58 +00:00
state 'FL'
city 'Miami'
last_jam_locidispid { miami_geoip[:locidispid] }
last_jam_addr { miami_ip }
end
factory :seattle_user do
first_name 'Seattle'
2016-06-02 14:04:56 +00:00
sequence(:last_name) { |n| "#{n}" }
2014-09-22 19:20:58 +00:00
state 'WA'
city 'Seattle'
last_jam_locidispid { seattle_geoip[:locidispid] }
last_jam_addr { seattle_ip }
end
2014-01-25 20:03:14 +00:00
factory :single_user_session do
after(:create) do |user, evaluator|
active_music_session = FactoryGirl.create(:active_music_session, :creator => user)
connection = FactoryGirl.create(:connection, :user => user, :music_session => active_music_session)
2014-01-25 20:03:14 +00:00
end
end
factory :teacher_user do
after(:create) do |user, evaluator|
teacher = FactoryGirl.create(:teacher, user: user, price_per_lesson_60_cents: 3000, price_per_month_60_cents: 3000)
2016-05-20 19:31:05 +00:00
user.is_a_teacher = true
user.save!
end
end
end
2016-01-28 19:55:17 +00:00
factory :teacher, :class => JamRuby::Teacher do
association :user, factory: :user
2016-06-02 14:04:56 +00:00
price_per_lesson_60_cents 3000
price_per_month_60_cents 3000
short_bio 'abc def uueue doc neck'
2016-01-28 19:55:17 +00:00
end
factory :musician_instrument, :class => JamRuby::MusicianInstrument do
instrument { JamRuby::Instrument.find('electric guitar') }
proficiency_level 1
priority 0
end
factory :active_music_session_no_user_history, :class => JamRuby::ActiveMusicSession do
association :creator, factory: :user
transient do
2014-05-06 13:34:38 +00:00
name "My Music Session"
description "Come Music Session"
fan_chat true
fan_access true
approval_required false
musician_access true
legal_terms true
genre JamRuby::Genre.first
band nil
language 'eng'
2014-05-06 13:34:38 +00:00
end
2014-01-25 20:03:14 +00:00
2014-05-06 13:34:38 +00:00
before(:create) do |session, evaluator|
if evaluator.music_session
session.id = evaluator.music_session.id
else
music_session = FactoryGirl.create(:music_session, name: evaluator.name, description: evaluator.description, fan_chat: evaluator.fan_chat,
fan_access: evaluator.fan_access, approval_required: evaluator.approval_required, musician_access: evaluator.musician_access,
genre: evaluator.genre, creator: evaluator.creator, band: evaluator.band, language: evaluator.language)
session.id = music_session.id
end
2014-05-06 13:34:38 +00:00
end
2014-05-06 13:34:38 +00:00
factory :active_music_session do
after(:create) { |session|
2014-05-06 13:34:38 +00:00
FactoryGirl.create(:music_session_user_history, :history => session.music_session, :user => session.creator)
}
factory :active_music_session_with_mount do
2014-01-25 20:03:14 +00:00
association :mount, :factory => :icecast_mount
end
2014-01-25 20:03:14 +00:00
end
end
2016-06-02 14:04:56 +00:00
2014-05-06 22:50:41 +00:00
factory :music_session, :class => JamRuby::MusicSession do
ignore do
student nil
end
sequence(:name) { |n| "Music Session #{n}" }
sequence(:description) { |n| "Music Session Description #{n}" }
fan_chat true
fan_access true
approval_required false
musician_access true
legal_terms true
language 'eng'
timezone 'UTC,Etc/UTC'
legal_policy 'standard'
2014-05-15 17:22:21 +00:00
recurring_mode 'once'
genre JamRuby::Genre.first
association :creator, :factory => :user
open_rsvps true
scheduled_start Time.now
scheduled_duration 3600
2014-05-15 17:22:21 +00:00
factory :recurring_music_session_weekly do
recurring_mode 'weekly'
end
after(:create) do |music_session|
FactoryGirl.create(:chosen_rsvp_slot, user: music_session.creator, music_session: music_session)
end
end
factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do
transient do
history nil
user nil
end
2013-04-17 00:36:01 +00:00
instruments 'guitar'
2014-05-06 13:34:38 +00:00
music_session_id { history.id }
user_id { user.id }
sequence(:client_id) { |n| "Connection #{n}" }
end
factory :connection, :class => JamRuby::Connection do
2012-11-02 06:51:52 +00:00
sequence(:client_id) { |n| "Client#{n}" }
2014-02-22 04:21:31 +00:00
ip_address "1.1.1.1"
as_musician true
2014-02-22 04:21:31 +00:00
addr 0
locidispid 0
client_type 'client'
gateway 'gateway1'
2014-06-18 01:07:40 +00:00
last_jam_audio_latency { user.last_jam_audio_latency if user }
2016-06-02 14:04:56 +00:00
sequence(:channel_id) { |n| "Channel#{n}" }
2014-05-16 19:39:37 +00:00
association :user, factory: :user
2014-09-13 03:30:51 +00:00
scoring_timeout Time.now
end
factory :invitation, :class => JamRuby::Invitation do
end
factory :friendship, :class => JamRuby::Friendship do
end
2012-11-12 12:28:44 +00:00
2014-03-25 15:29:08 +00:00
factory :friend_request, :class => JamRuby::FriendRequest do
end
2012-12-06 01:56:12 +00:00
factory :band_musician, :class => JamRuby::BandMusician do
end
2012-11-12 12:28:44 +00:00
factory :band, :class => JamRuby::Band do
2016-06-02 14:04:56 +00:00
sequence(:name) { |n| "Band" }
biography "My Biography"
city "Apex"
state "NC"
country "US"
before(:create) { |band|
band.genres << Genre.first
}
2012-11-12 12:28:44 +00:00
end
2012-12-05 19:10:58 +00:00
factory :genre, :class => JamRuby::Genre do
description { |n| "Genre #{n}" }
end
factory :language, :class => JamRuby::Language do
id { |n| "Language #{n}" }
description { |n| "Language #{n}" }
end
factory :subject, :class => JamRuby::Subject do
id { |n| "Subject #{n}" }
description { |n| "Subject #{n}" }
end
factory :join_request, :class => JamRuby::JoinRequest do
text 'let me in to the session!'
end
2013-01-15 02:13:45 +00:00
factory :track, :class => JamRuby::Track do
sound "mono"
2016-06-02 14:04:56 +00:00
sequence(:client_track_id) { |n| "client_track_id#{n}" }
sequence(:client_resource_id) { |n| "resource_id#{n}" }
2013-01-15 02:13:45 +00:00
end
2015-02-16 04:01:06 +00:00
factory :backing_track, :class => JamRuby::BackingTrack do
2016-06-02 14:04:56 +00:00
sequence(:client_track_id) { |n| "client_track_id#{n}" }
2015-02-16 04:01:06 +00:00
filename 'foo.mp3'
end
factory :video_source, :class => JamRuby::VideoSource do
#client_video_source_id "test_source_id"
2016-06-02 14:04:56 +00:00
sequence(:client_video_source_id) { |n| "client_video_source_id#{n}" }
end
2013-01-30 05:46:40 +00:00
factory :recorded_track, :class => JamRuby::RecordedTrack do
instrument JamRuby::Instrument.find('acoustic guitar')
sound 'stereo'
2016-06-02 14:04:56 +00:00
sequence(:client_id) { |n| "client_id-#{n}" }
sequence(:track_id) { |n| "track_id-#{n}" }
sequence(:client_track_id) { |n| "client_track_id-#{n}" }
md5 'abc'
length 1
fully_uploaded true
2016-06-02 14:04:56 +00:00
association :user, factory: :user
association :recording, factory: :recording
2013-01-15 02:13:45 +00:00
end
2015-02-16 04:01:06 +00:00
factory :recorded_backing_track, :class => JamRuby::RecordedBackingTrack do
2016-06-02 14:04:56 +00:00
sequence(:client_id) { |n| "client_id-#{n}" }
sequence(:backing_track_id) { |n| "track_id-#{n}" }
sequence(:client_track_id) { |n| "client_track_id-#{n}" }
sequence(:filename) { |n| "filename-{#n}" }
sequence(:url) { |n| "/recordings/blah/#{n}" }
2015-02-16 04:01:06 +00:00
md5 'abc'
length 1
fully_uploaded true
2016-06-02 14:04:56 +00:00
association :user, factory: :user
association :recording, factory: :recording
2015-02-16 04:01:06 +00:00
end
factory :recorded_video, :class => JamRuby::RecordedVideo do
2016-06-02 14:04:56 +00:00
sequence(:client_video_source_id) { |n| "client_video_source_id-#{n}" }
fully_uploaded true
length 1
2016-06-02 14:04:56 +00:00
association :user, factory: :user
association :recording, factory: :recording
end
2015-02-25 16:43:21 +00:00
factory :recorded_jam_track_track, :class => JamRuby::RecordedJamTrackTrack do
2016-06-02 14:04:56 +00:00
association :user, factory: :user
association :recording, factory: :recording
2015-02-25 16:43:21 +00:00
association :jam_track_track, factory: :jam_track_track
end
2013-01-15 02:13:45 +00:00
factory :instrument, :class => JamRuby::Instrument do
2014-02-06 21:53:19 +00:00
description { |n| "Instrument #{n}" }
2013-01-15 02:13:45 +00:00
end
2014-02-06 21:53:19 +00:00
2013-01-30 05:46:40 +00:00
factory :recording, :class => JamRuby::Recording do
2013-04-17 00:36:01 +00:00
2016-06-02 14:04:56 +00:00
association :owner, factory: :user
association :music_session, factory: :active_music_session
association :band, factory: :band
factory :recording_with_track do
before(:create) { |recording|
recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner)
}
end
end
factory :claimed_recording, :class => JamRuby::ClaimedRecording do
sequence(:name) { |n| "name-#{n}" }
sequence(:description) { |n| "description-#{n}" }
is_public true
2016-06-02 14:04:56 +00:00
association :genre, factory: :genre
association :user, factory: :user
2014-11-06 17:26:13 +00:00
before(:create) { |claimed_recording, evaluator|
claimed_recording.recording = FactoryGirl.create(:recording_with_track, owner: claimed_recording.user) unless evaluator.recording
}
end
factory :mix, :class => JamRuby::Mix do
transient do
2014-11-06 17:26:13 +00:00
autowire true
end
started_at Time.now
completed_at Time.now
ogg_md5 'abc'
ogg_length 1
sequence(:ogg_url) { |n| "recordings/ogg/#{n}" }
mp3_md5 'abc'
mp3_length 1
sequence(:mp3_url) { |n| "recordings/mp3/#{n}" }
completed true
2016-06-02 14:04:56 +00:00
before(:create) { |mix, evaluator|
2014-11-06 17:26:13 +00:00
if evaluator.autowire
user = FactoryGirl.create(:user)
mix.recording = FactoryGirl.create(:recording_with_track, owner: user)
mix.recording.claimed_recordings << FactoryGirl.create(:claimed_recording, user: user, recording: mix.recording)
end
}
2013-01-30 05:46:40 +00:00
end
2013-03-15 04:22:31 +00:00
factory :quick_mix, :class => JamRuby::QuickMix do
transient do
autowire true
end
started_at nil
completed_at nil
ogg_md5 nil
ogg_length 0
ogg_url nil
mp3_md5 nil
mp3_length 0
mp3_url nil
completed false
2016-06-02 14:04:56 +00:00
before(:create) { |mix, evaluator|
if evaluator.autowire
user = FactoryGirl.create(:user)
mix.user = user
mix.recording = FactoryGirl.create(:recording_with_track, owner: user)
mix.recording.claimed_recordings << FactoryGirl.create(:claimed_recording, user: user, recording: mix.recording)
end
}
2014-11-06 17:26:13 +00:00
factory :quick_mix_completed do
started_at 1.minute.ago
completed_at Time.now
ogg_md5 'a'
ogg_length 1
ogg_url 'recordings/ogg'
mp3_md5 'a'
mp3_length 1
mp3_url 'recordings/mp3'
completed true
end
end
2013-03-15 04:22:31 +00:00
factory :invited_user, :class => JamRuby::InvitedUser do
sequence(:email) { |n| "user#{n}@someservice.com" }
autofriend false
end
2013-04-16 02:12:16 +00:00
factory :music_session_perf_data, :class => JamRuby::MusicSessionPerfData do
2013-04-17 00:36:01 +00:00
association :music_session => :music_session
2013-04-16 02:12:16 +00:00
end
2013-08-09 01:03:41 +00:00
factory :crash_dump, :class => JamRuby::CrashDump do
end
2013-11-03 03:07:16 +00:00
factory :promo_buzz, :class => JamRuby::PromoBuzz do
text_short Faker::Lorem.characters(10)
text_long Faker::Lorem.paragraphs(3).join("\n")
end
factory :icecast_limit, :class => JamRuby::IcecastLimit do
clients 5
sources 1
queue_size 102400
client_timeout 30
header_timeout 15
source_timeout 10
burst_size 65536
end
factory :icecast_admin_authentication, :class => JamRuby::IcecastAdminAuthentication do
2016-06-02 14:04:56 +00:00
source_pass Faker::Lorem.characters(10)
admin_user Faker::Lorem.characters(10)
admin_pass Faker::Lorem.characters(10)
relay_user Faker::Lorem.characters(10)
relay_pass Faker::Lorem.characters(10)
end
factory :icecast_directory, :class => JamRuby::IcecastDirectory do
2016-06-02 14:04:56 +00:00
yp_url_timeout 15
yp_url Faker::Lorem.characters(10)
end
factory :icecast_master_server_relay, :class => JamRuby::IcecastMasterServerRelay do
2016-06-02 14:04:56 +00:00
master_server Faker::Lorem.characters(10)
master_server_port 8000
master_update_interval 120
2016-06-02 14:04:56 +00:00
master_username Faker::Lorem.characters(10)
master_pass Faker::Lorem.characters(10)
relays_on_demand 1
end
factory :icecast_path, :class => JamRuby::IcecastPath do
2016-06-02 14:04:56 +00:00
base_dir Faker::Lorem.characters(10)
log_dir Faker::Lorem.characters(10)
pid_file Faker::Lorem.characters(10)
web_root Faker::Lorem.characters(10)
admin_root Faker::Lorem.characters(10)
end
factory :icecast_logging, :class => JamRuby::IcecastLogging do
2016-06-02 14:04:56 +00:00
access_log Faker::Lorem.characters(10)
error_log Faker::Lorem.characters(10)
log_level 3
log_archive nil
log_size 10000
end
factory :icecast_security, :class => JamRuby::IcecastSecurity do
2016-06-02 14:04:56 +00:00
chroot 0
end
factory :icecast_mount, :class => JamRuby::IcecastMount do
2016-06-02 14:04:56 +00:00
sequence(:name) { |n| "/mount_#{n}" }
source_username Faker::Lorem.characters(10)
source_pass Faker::Lorem.characters(10)
max_listeners 100
max_listener_duration 3600
2016-06-02 14:04:56 +00:00
fallback_mount Faker::Lorem.characters(10)
fallback_override 1
fallback_when_full 1
is_public -1
stream_name Faker::Lorem.characters(10)
stream_description Faker::Lorem.characters(10)
stream_url Faker::Lorem.characters(10)
genre Faker::Lorem.characters(10)
hidden 0
association :server, factory: :icecast_server_with_overrides
factory :icecast_mount_with_auth do
association :authentication, :factory => :icecast_user_authentication
factory :iceast_mount_with_template do
association :mount_template, :factory => :icecast_mount_template
factory :iceast_mount_with_music_session do
association :music_session, :factory => :active_music_session
end
end
end
end
factory :icecast_source_change, :class => JamRuby::IcecastSourceChange do
source_direction true
success true
2016-06-02 14:04:56 +00:00
sequence(:client_id) { |n| "client_id#{n}" }
change_type JamRuby::IcecastSourceChange::CHANGE_TYPE_CLIENT
2016-06-02 14:04:56 +00:00
association :user, :factory => :user
association :mount, :factory => :iceast_mount_with_music_session
end
factory :icecast_listen_socket, :class => JamRuby::IcecastListenSocket do
2016-06-02 14:04:56 +00:00
port 8000
end
factory :icecast_relay, :class => JamRuby::IcecastRelay do
2016-06-02 14:04:56 +00:00
port 8000
mount Faker::Lorem.characters(10)
server Faker::Lorem.characters(10)
on_demand 1
end
factory :icecast_user_authentication, :class => JamRuby::IcecastUserAuthentication do
authentication_type 'url'
2016-06-02 14:04:56 +00:00
unused_username Faker::Lorem.characters(10)
unused_pass Faker::Lorem.characters(10)
mount_add Faker::Lorem.characters(10)
mount_remove Faker::Lorem.characters(10)
listener_add Faker::Lorem.characters(10)
listener_remove Faker::Lorem.characters(10)
auth_header 'icecast-auth-user: 1'
timelimit_header 'icecast-auth-timelimit:'
end
factory :icecast_server, :class => JamRuby::IcecastServer do
2016-06-02 14:04:56 +00:00
sequence(:hostname) { |n| "hostname-#{n}" }
sequence(:server_id) { |n| "test-server-#{n}" }
factory :icecast_server_minimal do
association :template, :factory => :icecast_template_minimal
association :mount_template, :factory => :icecast_mount_template
factory :icecast_server_with_overrides do
association :limit, :factory => :icecast_limit
association :admin_auth, :factory => :icecast_admin_authentication
association :path, :factory => :icecast_path
association :logging, :factory => :icecast_logging
association :security, :factory => :icecast_security
before(:create) do |server|
server.listen_sockets << FactoryGirl.build(:icecast_listen_socket)
end
end
end
end
factory :icecast_mount_template, :class => JamRuby::IcecastMountTemplate do
2016-06-02 14:04:56 +00:00
sequence(:name) { |n| "name-#{n}" }
source_username Faker::Lorem.characters(10)
source_pass Faker::Lorem.characters(10)
max_listeners 100
max_listener_duration 3600
2016-06-02 14:04:56 +00:00
fallback_mount Faker::Lorem.characters(10)
fallback_override 1
fallback_when_full 1
is_public -1
stream_name Faker::Lorem.characters(10)
stream_description Faker::Lorem.characters(10)
stream_url Faker::Lorem.characters(10)
genre Faker::Lorem.characters(10)
hidden 0
association :authentication, :factory => :icecast_user_authentication
end
factory :icecast_template, :class => JamRuby::IcecastTemplate do
2016-06-02 14:04:56 +00:00
sequence(:name) { |n| "name-#{n}" }
sequence(:location) { |n| "location-#{n}" }
factory :icecast_template_minimal do
association :limit, :factory => :icecast_limit
association :admin_auth, :factory => :icecast_admin_authentication
association :path, :factory => :icecast_path
association :logging, :factory => :icecast_logging
association :security, :factory => :icecast_security
before(:create) do |template|
template.listen_sockets << FactoryGirl.build(:icecast_listen_socket)
end
end
end
2014-02-03 21:19:14 +00:00
factory :facebook_signup, :class => JamRuby::FacebookSignup do
2016-06-02 14:04:56 +00:00
sequence(:lookup_id) { |n| "lookup-#{n}" }
sequence(:first_name) { |n| "first-#{n}" }
sequence(:last_name) { |n| "last-#{n}" }
gender 'M'
sequence(:email) { |n| "jammin-#{n}@jamkazam.com" }
sequence(:uid) { |n| "uid-#{n}" }
sequence(:token) { |n| "token-#{n}" }
token_expires_at Time.now
2014-02-03 21:19:14 +00:00
end
2014-02-17 23:26:17 +00:00
2014-11-06 17:26:13 +00:00
factory :recording_comment, :class => JamRuby::RecordingComment do
sequence(:comment) { |n| "comment-#{n}" }
2016-06-02 14:04:56 +00:00
association :recording, factory: :recording
association :user, factory: :recording
2014-11-06 17:26:13 +00:00
end
factory :playable_play, :class => JamRuby::PlayablePlay do
2016-06-02 14:04:56 +00:00
association :user, factory: :user
end
factory :recording_like, :class => JamRuby::RecordingLiker do
end
factory :music_session_like, :class => JamRuby::MusicSessionLiker do
2014-02-17 23:26:17 +00:00
end
factory :event, :class => JamRuby::Event do
2016-06-02 14:04:56 +00:00
sequence(:slug) { |n| "slug-#{n}" }
title 'event title'
description 'event description'
2014-03-10 06:31:20 +00:00
end
2014-03-10 06:31:20 +00:00
factory :event_session, :class => JamRuby::EventSession do
end
factory :email_batch, :class => JamRuby::EmailBatch do
subject Faker::Lorem.sentence
2014-03-18 18:33:48 +00:00
body "#{JamRuby::EmailBatch::VAR_FIRST_NAME} " + Faker::Lorem.paragraphs(3).join("\n")
test_emails 4.times.collect { Faker::Internet.safe_email }.join(',')
end
2014-05-16 07:58:06 +00:00
factory :email_batch_new_musician, :class => JamRuby::EmailBatchNewMusician do
2014-05-18 00:12:01 +00:00
end
2014-05-16 07:58:06 +00:00
2014-05-18 00:12:01 +00:00
factory :email_batch_progression, :class => JamRuby::EmailBatchProgression do
2014-05-16 07:58:06 +00:00
end
2014-05-29 07:19:55 +00:00
factory :email_batch_scheduled_session, :class => JamRuby::EmailBatchScheduledSessions do
end
factory :notification, :class => JamRuby::Notification do
factory :notification_text_message do
description 'TEXT_MESSAGE'
message Faker::Lorem.characters(10)
end
end
2014-04-30 03:01:28 +00:00
factory :diagnostic, :class => JamRuby::Diagnostic do
type JamRuby::Diagnostic::NO_HEARTBEAT_ACK
creator JamRuby::Diagnostic::CLIENT
data Faker::Lorem.sentence
end
factory :rsvp_slot, :class => JamRuby::RsvpSlot do
proficiency_level "beginner"
2014-06-24 15:33:31 +00:00
instrument { Instrument.find('electric guitar') }
factory :chosen_rsvp_slot do
transient do
user nil
end
after(:create) do |rsvp_slot, evaluator|
rsvp_request = FactoryGirl.create(:rsvp_request, user: evaluator.user)
2016-06-02 14:04:56 +00:00
rsvp_request_rsvp_slot = FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: rsvp_request, rsvp_slot: rsvp_slot)
end
end
end
factory :rsvp_request, class: JamRuby::RsvpRequest do
canceled false
2014-06-07 17:01:03 +00:00
cancel_all false
association :user, :factory => :user
# creates *number* slots for a new rsvp_request (the case were you are too lazy / don't care to set up slots)
factory :rsvp_request_for_multiple_slots do
transient do
2020-12-28 05:44:17 +00:00
#music_session nil
number 1
2020-12-28 05:44:17 +00:00
#chosen nil
end
2016-06-02 14:04:56 +00:00
after(:create) { |rsvp_request, evaluator|
evaluator.number.times do |i|
slot = FactoryGirl.create(:rsvp_slot, music_session: evaluator.music_session, instrument: Instrument.order(:id).limit(1).offset(i).first, proficiency_level: 1)
2016-06-02 14:04:56 +00:00
FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot)
end
}
end
# creates a rsvp_request for the specified slots (helps when you already have a slot(s), and need to request to them)
factory :rsvp_request_for_slots do
transient do
slots nil
chosen nil
end
2016-06-02 14:04:56 +00:00
after(:create) { |rsvp_request, evaluator|
evaluator.slots.each do |slot|
2016-06-02 14:04:56 +00:00
FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot)
end
}
end
2014-05-21 04:57:32 +00:00
end
2014-05-31 11:41:59 +00:00
factory :rsvp_request_rsvp_slot, :class => JamRuby::RsvpRequestRsvpSlot do
chosen false
end
2014-05-16 19:39:37 +00:00
factory :latency_tester, :class => JamRuby::LatencyTester do
transient do
2014-05-19 13:46:03 +00:00
connection nil
2016-06-02 14:04:56 +00:00
make_connection true
2014-05-19 13:46:03 +00:00
end
sequence(:client_id) { |n| "LatencyTesterClientId-#{n}" }
after(:create) do |latency_tester, evaluator|
latency_tester.connection = evaluator.connection if evaluator.connection
latency_tester.connection = FactoryGirl.create(:connection, client_type: Connection::TYPE_LATENCY_TESTER, client_id: latency_tester.client_id) if evaluator.make_connection
latency_tester.save
end
2014-05-16 19:39:37 +00:00
end
2014-07-14 20:53:04 +00:00
factory :max_mind_release, :class => JamRuby::MaxMindRelease do
released_at Time.now.to_date
end
factory :jam_track_licensor, :class => JamRuby::JamTrackLicensor do
sequence(:name) { |n| "licensor-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:attention) { |n| "attention-#{n}" }
sequence(:address_line_1) { |n| "address1-#{n}" }
sequence(:address_line_2) { |n| "address2-#{n}" }
sequence(:city) { |n| "city-#{n}" }
sequence(:state) { |n| "state-#{n}" }
sequence(:zip_code) { |n| "zipcode-#{n}" }
sequence(:contact) { |n| "contact-#{n}" }
sequence(:email) { |n| "email-#{n}" }
sequence(:phone) { |n| "phone-#{n}" }
end
factory :jam_track_mixdown, :class => JamRuby::JamTrackMixdown do
2016-06-02 14:04:56 +00:00
association :user, factory: :user
association :jam_track, factory: :jam_track
sequence(:name) { |n| "mixdown-#{n}" }
settings '{"speed":5}'
end
factory :jam_track_mixdown_package, :class => JamRuby::JamTrackMixdownPackage do
2016-06-02 14:04:56 +00:00
file_type JamRuby::JamTrackMixdownPackage::FILE_TYPE_OGG
sample_rate 48
signing false
signed false
2016-06-02 14:04:56 +00:00
association :jam_track_mixdown, factory: :jam_track_mixdown
end
factory :jam_track, :class => JamRuby::JamTrack do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
Squashed commit of the following: commit 30965c6351a4db3897617a0b0d9ae8aabd06d930 Author: Seth Call <sethcall@gmail.com> Date: Tue Sep 15 05:23:27 2015 -0500 * allow jamblaster to fetch http commit 5c8fb6b01ecb11dc0417b3158044da5205759420 Author: Seth Call <sethcall@gmail.com> Date: Fri Sep 11 13:43:07 2015 -0500 * don't issue stop video in session end commit 3e27680ea9fc7161cc23b888a792ed1269bc327c Author: Seth Call <sethcall@gmail.com> Date: Fri Sep 11 13:40:34 2015 -0500 * decommision webcam_viewer in session page commit ac1cc0c8289bd6aefea3ffabbdd6cd9557be8872 Author: Seth Call <sethcall@gmail.com> Date: Thu Sep 10 07:24:42 2015 -0500 * VRFS-3541 - don't use HTML to store data sent to server for genre ID bug in profile commit 004991119a99d7826019c426d75ed1312feaba55 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 9 15:10:51 2015 -0500 * set 'are you our user' cookie to do better job with ad tracking commit 13a950e65ff0352b05aa8f0646295ed3909a20b2 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 9 07:58:46 2015 -0500 * align disable vide obutton better commit 9722c6cbc632daa40e06c67611a3a388b078cb82 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 9 07:45:18 2015 -0500 * whitesapce commit 3976707b14a061371544b4bedb1b991894eb4fb6 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 9 07:13:51 2015 -0500 * check for video enabled better commit b483dd537f087e29202d0deb6262540ac76014a9 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 9 07:02:12 2015 -0500 * better text for video test commit a4f465b6d19eabeabe940ddf1992e50d668d1f26 Author: Seth Call <sethcall@gmail.com> Date: Tue Sep 8 20:30:47 2015 -0500 * VRFS-3530, VRFS-3531 - allow user to test and disable video commit ba99f88048dc4e47adc220235d54b74b6f1afaee Author: Seth Call <sethcall@gmail.com> Date: Tue Sep 8 10:05:26 2015 -0500 * VRFS-3534 - fix start recording API signature commit 386ed8144c2d70447ae203c5a5e0b6afad25f654 Author: Seth Call <sethcall@gmail.com> Date: Sun Sep 6 19:03:08 2015 -0500 * VRFS-3528 - make sure open jamtrack dialog passes 'show_purchased_only' commit 6d010a561b389514116b24f9f9789a274659a287 Author: Seth Call <sethcall@gmail.com> Date: Fri Sep 4 20:43:15 2015 -0500 * deal with too-few tracks on landing page, and the 3rd CTA bubble clipping off text commit 0076f0205ab0ce5e8592c4dd7e101d72ca379f2c Author: Seth Call <sethcall@gmail.com> Date: Fri Sep 4 15:00:45 2015 -0500 * VRFS-352 - instrument-centric landing page commit 3ee71634b36d69e93cbf4b6aced2aa726f80b949 Author: Seth Call <sethcall@gmail.com> Date: Wed Sep 2 09:40:06 2015 -0500 * remove test stuff commit d07ac009bf8c51126af9d16ff592e7d547b85de9 Author: Seth Call <sethcall@gmail.com> Date: Tue Sep 1 08:11:35 2015 -0500 * VRFS-3509 - case where no device is configured handled commit 9420cebad48a3e9a854f497f2bf5e7b77cbb91f4 Author: Seth Call <sethcall@gmail.com> Date: Sun Aug 30 05:00:00 2015 -0500 * VRFS-3494 - show popup when video window launches for the 1st time to offer guidance commit c3f81a4d236126d4913da173fd9794cce525a2ce Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 27 10:35:43 2015 -0500 * build bump commit e782d5f9bb31d62c555249466be6f34991f84074 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 27 09:43:40 2015 -0500 * VRFS-3419 - check better for window opener commit 36b6699cde5adf15d6bbcaf9f4b1442d644c52a4 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 27 08:12:47 2015 -0500 * validate popup VRFS-3419 commit 8948f0498f79675e9dd9568b82e7480a187dceee Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 27 07:59:21 2015 -0500 * fix changed path commit 2bce35d60402bb06a6773c48323d3973143653e0 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 20:38:34 2015 -0500 * fix jamtrack test commit 63ef63c20daae56ded7367fe7bd7c7209371bacc Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 20:34:40 2015 -0500 * fix typo again in webcamViewer. need to go to bed commit 8566cc5bc91bbead2ad3d9a812c28fb992c9ef6d Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 20:31:34 2015 -0500 * fix typo added in webcamViewer commit 22ea6e89fdc73f2d1b34faf74ffc7a76b8c9fc99 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 20:26:39 2015 -0500 * VRFS-3488 - jamtrack search by artist and song need to pin to the match, not do a sloppy search commit a4bd28e1687984f35488da7b63e5bf3f5e0d881b Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 16:43:34 2015 -0500 VRFS-3474 - watch for USB events and refresh video pages commit d2edfd22c501c4fcd73bee85ce32cfe23bcd703f Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 12:01:52 2015 -0500 * VRFS-3467 - previews are 20 seconds long indicator on jamtracks commit defdfa8ce9e109961e2563e848e3fb44fce2b146 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 26 06:04:53 2015 -0500 * VRFS-3473 - fix 'videoShared' state in webcamViewer commit 090cfa17c0e3bab86f50bad4917b4e3701357166 Merge: 7560b34 818596a Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 25 14:53:35 2015 -0500 Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop commit 7560b340c777ff9d2c6cefc02fbc9d622df58452 Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 25 14:52:05 2015 -0500 * VRFS-3466 - updated frontend to pass in GUIDs commit 1252dbe1786535982b8cd8336a1f7d5dde6dcb8b Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 25 05:28:15 2015 -0500 * use new bridge calls to handle current FPS and resolution VRFS-3428 commit 818596ae36724d861a9f704d4d6c697b982df34d Author: Jonathan Kolyer <jonathan@jamkazam.com> Date: Tue Aug 25 08:23:52 2015 +0000 VRFS-3451 musician_search verifying instrument and genres inputs commit 6918eaf09573bfe592dd677f89ece86ef29e45f5 Author: Seth Call <sethcall@gmail.com> Date: Mon Aug 24 17:55:06 2015 -0500 more UI tweaks for video settup in account screen VRFS-3428 commit fc69242578f00e99cb83a3432dc0552c3be212c9 Author: Seth Call <sethcall@gmail.com> Date: Mon Aug 24 16:18:31 2015 -0500 * VRFS-3427 - update FTUE to test video, not just audio commit 729974013a242216570536938fb52f74de4387f9 Author: Seth Call <sethcall@gmail.com> Date: Mon Aug 24 16:17:53 2015 -0500 * VRFS-3428 - fix button text commit db1f1d60d5434abad4c112d5bc58e20b05d180f9 Merge: 04825d2 90c8d05 Author: Seth Call <sethcall@gmail.com> Date: Mon Aug 24 15:56:42 2015 -0500 Merge branch 'feature/video_frontend' into develop commit 04825d2659ebbc601069a3a0638aca2ff249ff6c Author: Seth Call <sethcall@gmail.com> Date: Mon Aug 24 15:54:59 2015 -0500 * VRFS-3428 - update how we query backend for frame rates commit 39d0731d7402a05edfe1e891132e118b234b6f1b Author: Seth Call <sethcall@gmail.com> Date: Sat Aug 22 05:44:59 2015 -0500 * VRFS-3456 - remove special chars from search commit 1874720ee87bc4ac0dd4bc48c462469b6ba34fd4 Author: Seth Call <sethcall@gmail.com> Date: Sat Aug 22 05:32:28 2015 -0500 * VRFS-3456 - protect special chars from tsquery commit 29104ff09b0d287b473af65522bd172115b0fd43 Author: Seth Call <sethcall@gmail.com> Date: Fri Aug 21 05:02:48 2015 -0500 * VRFS-3446 - bug fix for no genre specified on join of session; also fix search bar in jamtrack dialog commit 3b6d1febdb7ebd96b7ff3727e3094c6f968a09ea Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 15:44:21 2015 -0500 * forget cta image commit 6ac622853c8a9b2c34961e7f922f57450f41c7e4 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 15:02:55 2015 -0500 * VRFS-3449 - a little more tweaking of JamTrack landing page commit d7fcadcd0dd21b24ce1166096a17216fec345fea Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 14:49:07 2015 -0500 * VRFS-3450 - fix 'show all tracks' when pagination occurs by not doubleregistering commit e7b50ca4a84de67f0a5519457d93d5729f9c5236 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 14:19:07 2015 -0500 * VRFS-3449 - updates for direct landing pages commit 0d075a9568685aea40fdfe1106cf6332073d2494 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 09:19:17 2015 -0500 * fix spacing issue commit 9c17d9a024936f98b22bee4bfcbf8089c63b9383 Merge: 9873450 0b67ef5 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 09:06:48 2015 -0500 Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop commit 98734506dfa2c6420fd683429697deb2ccddf572 Author: Seth Call <sethcall@gmail.com> Date: Thu Aug 20 09:06:36 2015 -0500 * VRFS-3448 - fix invisible downloader commit 90c8d05d00a98195617ed47b51f04e8a7584cba2 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 14:17:10 2015 -0500 * wip commit bf4044d92e172869e4e5cbe67e01bfc25b7e877f Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 09:24:14 2015 -0500 * VRFS-3422 - don't die if the user has on sale_line_items commit 87c62b4db2a0e6618593ef5d1ec32a0c6b2eb284 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 08:29:22 2015 -0500 * a fix for linux? hfa code commit 3fa58715fcf0aa63017e0be42e7f5b0ac4b9b8ac Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 07:36:04 2015 -0500 * fix open jamtrack dialog for people with less than 10 jamtracks commit d045c94f54095bd413add20fde3555d8c32279a1 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 07:17:37 2015 -0500 * more HFA request polish commit dc343f10e3ddf21560b9178f097a60eedd097669 Author: Seth Call <sethcall@gmail.com> Date: Wed Aug 19 07:01:47 2015 -0500 * don't show free jamtrack notice on landing page if redeemed_jamtrack cookie is set commit e6618da456a675ddbe4d1eb2a51bbf21ae86a41c Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 18 21:29:15 2015 -0500 * fix a bug in figuring out if the user should be show GET IT FREE commit 5ba03a2755e7d84b4019c951ea59156500a1ea01 Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 18 20:41:37 2015 -0500 * VRFS-3431 - better response when creating HFA request commit 37d6c3e57c64e5bc7655ff6de317ee628a9499f4 Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 18 15:19:40 2015 -0500 * add csv to dump released JamTracks commit f6101f3621af96255070e3346f377d5e42895a87 Author: Seth Call <sethcall@gmail.com> Date: Tue Aug 18 14:26:41 2015 -0500 VRFS-3422, VRFS-3423, VRFS-3424, VRFS-3429 - JamTrack search/listing commit 0b67ef5f52416080dcb94d5a2a5a1a7a998a3f3f Author: Jonathan Kolyer <jonathan@jamkazam.com> Date: Sat Aug 15 15:03:00 2015 +0000 fixed test for instruments in musician search
2015-09-19 21:33:39 +00:00
sequence(:slug) { |n| "slug-#{n}" }
2016-06-02 14:04:56 +00:00
time_signature '4/4'
status 'Production'
recording_type 'Cover'
sequence(:original_artist) { |n| "original-artist-#{n}" }
sequence(:songwriter) { |n| "songwriter-#{n}" }
sequence(:publisher) { |n| "publisher-#{n}" }
2016-06-02 14:04:56 +00:00
sales_region 'United States'
price 1.99
2017-06-23 23:39:22 +00:00
download_price 2.99
2016-06-02 14:04:56 +00:00
reproduction_royalty true
public_performance_royalty true
reproduction_royalty_amount 0.999
licensor_royalty_amount 0.999
2016-06-02 14:04:56 +00:00
sequence(:plan_code) { |n| "jamtrack-#{n}" }
2016-06-02 14:04:56 +00:00
genres [JamRuby::Genre.first]
association :licensor, factory: :jam_track_licensor
factory :jam_track_with_tracks do
after(:create) do |jam_track, evaluator|
FactoryGirl.create(:jam_track_track, jam_track: jam_track)
end
end
end
factory :jam_track_track, :class => JamRuby::JamTrackTrack do
2016-06-02 14:04:56 +00:00
position 1
part 'lead guitar'
track_type 'Track'
instrument JamRuby::Instrument.find('electric guitar')
association :jam_track, factory: :jam_track
end
factory :jam_track_right, :class => JamRuby::JamTrackRight do
2016-06-02 14:04:56 +00:00
association :jam_track, factory: :jam_track
association :user, factory: :user
2015-05-11 22:25:37 +00:00
signing_44 false
signing_48 false
end
factory :download_tracker, :class => JamRuby::DownloadTracker do
2016-06-02 14:04:56 +00:00
remote_ip '1.1.1.1'
paid false
association :user, factory: :user
association :jam_track, factory: :jam_track
end
factory :sale, :class => JamRuby::Sale do
order_total 0
2016-06-02 14:04:56 +00:00
association :user, factory: user
end
factory :recurly_transaction_web_hook, :class => JamRuby::RecurlyTransactionWebHook do
transaction_type JamRuby::RecurlyTransactionWebHook::SUCCESSFUL_PAYMENT
2016-06-02 14:04:56 +00:00
sequence(:recurly_transaction_id) { |n| "recurly-transaction-id-#{n}" }
sequence(:subscription_id) { |n| "subscription-id-#{n}" }
sequence(:invoice_id) { |n| "invoice-id-#{n}" }
sequence(:invoice_number) { |n| 1000 + n }
invoice_number_prefix nil
action 'purchase'
status 'success'
transaction_at Time.now
amount_in_cents 199
reference 100000
message 'meh'
association :user, factory: :user
factory :recurly_transaction_web_hook_failed do
transaction_type JamRuby::RecurlyTransactionWebHook::FAILED_PAYMENT
end
end
2015-06-03 19:22:21 +00:00
factory :broadcast_notification, :class => JamRuby::BroadcastNotification do
title Faker::Lorem.sentence[0...50]
message Faker::Lorem.paragraph[0...200]
button_label Faker::Lorem.words(2).join(' ')[0...14]
frequency 3
end
2015-06-03 19:22:21 +00:00
factory :affiliate_partner, class: 'JamRuby::AffiliatePartner' do
sequence(:partner_name) { |n| "partner-#{n}" }
entity_type 'Individual'
signed_at Time.now
association :partner_user, factory: :user
end
factory :affiliate_quarterly_payment, class: 'JamRuby::AffiliateQuarterlyPayment' do
year 2015
quarter 0
association :affiliate_partner, factory: :affiliate_partner
end
factory :affiliate_monthly_payment, class: 'JamRuby::AffiliateMonthlyPayment' do
year 2015
month 0
association :affiliate_partner, factory: :affiliate_partner
end
factory :affiliate_referral_visit, class: 'JamRuby::AffiliateReferralVisit' do
ip_address '1.1.1.1'
association :affiliate_partner, factory: :affiliate_partner
end
factory :affiliate_legalese, class: 'JamRuby::AffiliateLegalese' do
legalese Faker::Lorem.paragraphs(6).join("\n\n")
end
2015-06-03 19:22:21 +00:00
factory :gift_card, class: 'JamRuby::GiftCard' do
2016-06-02 14:04:56 +00:00
sequence(:code) { n.to_s }
card_type JamRuby::GiftCardType::JAM_TRACKS_5
2015-11-29 19:58:10 +00:00
end
factory :gift_card_type, class: 'JamRuby::GiftCardType' do
2016-06-02 14:04:56 +00:00
card_type JamRuby::GiftCardType::JAM_TRACKS_5
2015-11-29 19:58:10 +00:00
end
factory :gift_card_purchase, class: 'JamRuby::GiftCardPurchase' do
association :user, factory: :user
end
2016-08-31 09:19:16 +00:00
factory :posa_card, class: 'JamRuby::PosaCard' do
sequence(:code) { |n| n.to_s }
2017-07-10 02:21:29 +00:00
card_type JamRuby::PosaCard::JAM_TRACKS_5
credits 5
requires_purchase false
purchased true
factory :posa_card_lesson_2 do
card_type JamRuby::PosaCard::JAM_CLASS_2
credits 2
lesson_package_type { JamRuby::LessonPackageType.test_drive_2 }
is_lesson true
end
factory :posa_card_lesson_4 do
card_type JamRuby::PosaCard::JAM_CLASS_4
credits 4
lesson_package_type { JamRuby::LessonPackageType.test_drive_4 }
is_lesson true
end
2018-05-21 02:57:53 +00:00
factory :amazon_test_drive_free_2 do
card_type JamRuby::PosaCard::JAM_CLASS_2
credits 2
lesson_package_type { JamRuby::LessonPackageType.amazon_test_drive_free_2 }
is_lesson true
is_test false
purchased true
preactivate true
end
2016-08-31 09:19:16 +00:00
end
factory :posa_card_type, class: 'JamRuby::PosaCardType' do
card_type JamRuby::PosaCardType::JAM_TRACKS_5
end
factory :posa_card_purchase, class: 'JamRuby::PosaCardPurchase' do
association :user, factory: :user
end
factory :jamblaster, class: 'JamRuby::Jamblaster' do
association :user, factory: :user
2016-06-02 14:04:56 +00:00
sequence(:serial_no) { |n| "serial_no#{n}" }
sequence(:client_id) { |n| "client_id#{n}" }
end
factory :jamblaster_pairing_request, class: 'JamRuby::JamblasterPairingRequest' do
association :user, factory: :user
association :jamblaster, factory: :jamblaster
2016-06-02 14:04:56 +00:00
sequence(:jamblaster_client_id) { |n| "jamblaster_client_id#{n}" }
sequence(:sibling_key) { |n| "sibling_key#{n}" }
end
factory :school, class: 'JamRuby::School' do
association :user, factory: :user
sequence(:name) { |n| "Dat Music School #{n}" }
enabled true
scheduling_communication 'teacher'
end
factory :school_invitation, class: 'JamRuby::SchoolInvitation' do
association :school, factory: :school
note "hey come in in"
as_teacher true
2016-06-02 14:04:56 +00:00
sequence(:email) { |n| "school_person#{n}@example.com" }
sequence(:first_name) { |n| "FirstName" }
sequence(:last_name) { |n| "LastName" }
accepted false
end
2016-08-31 09:19:16 +00:00
factory :retailer, class: 'JamRuby::Retailer' do
association :user, factory: :user
sequence(:name) { |n| "Dat Music Retailer" }
sequence(:slug) { |n| "retailer-#{n}" }
enabled true
end
factory :retailer_invitation, class: 'JamRuby::RetailerInvitation' do
association :retailer, factory: :retailer
note "hey come in in"
sequence(:email) { |n| "retail_person#{n}@example.com" }
sequence(:first_name) { |n| "FirstName" }
sequence(:last_name) { |n| "LastName" }
accepted false
end
factory :lesson_booking_slot, class: 'JamRuby::LessonBookingSlot' do
factory :lesson_booking_slot_single do
slot_type 'single'
2016-06-02 14:04:56 +00:00
preferred_day { Date.today + 3 }
day_of_week nil
hour 12
minute 30
timezone 'UTC'
end
factory :lesson_booking_slot_recurring do
slot_type 'recurring'
preferred_day nil
day_of_week 0
hour 12
minute 30
timezone 'UTC'
end
end
factory :lesson_booking, class: 'JamRuby::LessonBooking' do
association :user, factory: :user
association :teacher, factory: :teacher_user
2016-06-02 14:04:56 +00:00
card_presumed_ok false
sent_notices false
recurring false
lesson_length 30
lesson_type JamRuby::LessonBooking::LESSON_TYPE_FREE
payment_style JamRuby::LessonBooking::PAYMENT_STYLE_ELSEWHERE
description "Oh my goodness!"
status JamRuby::LessonBooking::STATUS_REQUESTED
before(:create) do |lesson_booking, evaluator|
lesson_booking.lesson_booking_slots = [FactoryGirl.build(:lesson_booking_slot_single, lesson_booking: lesson_booking),
FactoryGirl.build(:lesson_booking_slot_single, lesson_booking: lesson_booking)]
end
#lesson_booking_slots [FactoryGirl.build(:lesson_booking_slot_single), FactoryGirl.build(:lesson_booking_slot_single)]
end
factory :lesson_package_purchase, class: "JamRuby::LessonPackagePurchase" do
lesson_package_type { JamRuby::LessonPackageType.single }
association :user, factory: :user
association :teacher, factory: :teacher_user
price 30.00
factory :test_drive_purchase do
2016-05-05 02:20:38 +00:00
lesson_package_type { JamRuby::LessonPackageType.test_drive_4 }
association :lesson_booking, factory: :lesson_booking
price 49.99
end
end
factory :lesson_session, class: 'JamRuby::LessonSession' do
ignore do
student nil
end
2016-06-02 14:04:56 +00:00
music_session { FactoryGirl.create(:music_session, creator: student) }
lesson_booking { FactoryGirl.create(:lesson_booking, user: student, teacher: teacher) }
association :teacher, factory: :teacher_user
lesson_type JamRuby::LessonSession::LESSON_TYPE_SINGLE
duration 30
booked_price 49.99
status JamRuby::LessonSession::STATUS_REQUESTED
#teacher_complete true
#student_complete true
end
factory :charge, class: 'JamRuby::Charge' do
2016-06-02 14:04:56 +00:00
type 'JamRuby::Charge'
amount_in_cents 1000
end
factory :teacher_payment_charge, parent: :charge, class: 'JamRuby::TeacherPaymentCharge' do
2016-06-02 14:04:56 +00:00
type 'JamRuby::TeacherPaymentCharge'
association :user, factory: :user
end
factory :lesson_payment_charge, parent: :charge, class: 'JamRuby::LessonPaymentCharge' do
2016-06-02 14:04:56 +00:00
type 'JamRuby::LessonPaymentCharge'
association :user, factory: :user
end
factory :teacher_payment, class: 'JamRuby::TeacherPayment' do
association :teacher, factory: :teacher_user
association :teacher_payment_charge, factory: :teacher_payment_charge
amount_in_cents 1000
2016-05-23 17:26:32 +00:00
fee_in_cents 0
end
# you gotta pass either lesson_session or lesson_package_purchase for this to make sense
factory :teacher_distribution, class: 'JamRuby::TeacherDistribution' do
association :teacher, factory: :teacher_user
association :teacher_payment, factory: :teacher_payment
ready false
amount_in_cents 1000
end
2016-06-02 14:04:56 +00:00
factory :ip_blacklist, class: "JamRuby::IpBlacklist" do
remote_ip '1.1.1.1'
end
factory :ip_whitelist, class: "JamRuby::IpWhitelist" do
remote_ip '1.1.1.1'
end
factory :user_blacklist, class: "JamRuby::UserBlacklist" do
association :user, factory: :user
end
factory :user_whitelist, class: "JamRuby::UserWhitelist" do
association :user, factory: :user
end
2016-03-01 19:49:58 +00:00
factory :email_blacklist, class: "JamRuby::EmailBlacklist" do
2016-06-02 14:04:56 +00:00
sequence(:email) { |n| "person_#{n}@example.com" }
2016-03-01 19:49:58 +00:00
end
factory :music_notation, class: "JamRuby::MusicNotation" do
2016-06-02 14:04:56 +00:00
attachment_type { JamRuby::MusicNotation::TYPE_NOTATION }
association :user, factory: :user
file_url 'abc'
size 100
file_name 'some_file.jpg'
end
2016-06-02 14:04:56 +00:00
factory :test_drive_package, class: "JamRuby::TestDrivePackage" do
sequence(:name) { |n| "package-#{n}" }
trait :one_pack do
package_type 1
after(:create) do |package, evaluator|
1.times.each do
FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package)
end
end
end
trait :two_pack do
package_type 2
after(:create) do |package, evaluator|
2.times.each do
FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package)
end
end
end
trait :four_pack do
package_type 4
after(:create) do |package, evaluator|
4.times.each do
FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package)
end
end
end
end
factory :test_drive_package_teachers, class: "JamRuby::TestDrivePackageTeacher" do
association :user, factory: :teacher_user
association :test_drive_package, factory: [:test_drive_package, :four_pack]
end
factory :test_drive_package_choice, class: "JamRuby::TestDrivePackageChoice" do
association :user, factory: :user
association :test_drive_package, factory: [:test_drive_package, :four_pack]
end
factory :test_drive_package_choice_teacher, class: "JamRuby::TestDrivePackageChoiceTeacher" do
association :teacher, factory: :teacher_user
association :test_drive_package_choice, factory: :test_drive_package_choice
end
2014-03-10 06:31:20 +00:00
end