jam-cloud/spec/factories.rb

116 lines
3.0 KiB
Ruby
Raw Normal View History

include ActionDispatch::TestProcess # added for artifact_update http://stackoverflow.com/questions/5990835/factory-with-carrierwave-upload-field
FactoryGirl.define do
factory :user, :class => JamRuby::User do
sequence(:email) { |n| "person_#{n}@example.com"}
2012-11-18 03:41:26 +00:00
sequence(:first_name) { |n| "Person" }
sequence(:last_name) { |n| "#{n}" }
password "foobar"
password_confirmation "foobar"
2012-11-12 12:59:43 +00:00
email_confirmed true
2012-11-18 03:41:26 +00:00
musician true
city "Apex"
state "NC"
country "USA"
factory :admin do
admin true
end
2013-03-08 06:45:06 +00:00
before(:create) do |user|
user.musician_instruments << FactoryGirl.build(:musician_instrument, user: user)
end
factory :single_user_session do
after(:create) do |user, evaluator|
music_session = FactoryGirl.create(:music_session, :creator => user)
connection = FactoryGirl.create(:connection, :user => user, :music_session => music_session)
end
end
2013-03-08 06:45:06 +00:00
factory :invited_user do
administratively_created true
first_name nil
last_name nil
email_confirmed false
city nil
state nil
country nil
musician true
sequence(:signup_token) { |n| n }
end
end
factory :fan, :class => JamRuby::User do
sequence(:first_name) { |n| "Person" }
sequence(:last_name) { |n| "#{n}" }
2013-03-08 06:45:06 +00:00
sequence(:email) { |n| "fan_#{n}@example.com"}
password "foobar"
password_confirmation "foobar"
email_confirmed true
musician false
city "Apex"
state "NC"
country "USA"
end
factory :music_session, :class => JamRuby::MusicSession do
sequence(:description) { |n| "Music Session #{n}" }
fan_chat true
fan_access true
approval_required false
musician_access true
legal_terms true
2012-10-27 22:26:45 +00:00
end
factory :connection, :class => JamRuby::Connection do
2012-10-27 22:26:45 +00:00
sequence(:client_id) { |n| "Client#{n}" }
ip_address "1.1.1.1"
as_musician true
2012-10-27 22:26:45 +00:00
end
factory :friendship, :class => JamRuby::Friendship do
end
2012-10-27 22:26:45 +00:00
factory :invitation, :class => JamRuby::Invitation do
end
2012-11-12 12:59:43 +00:00
factory :band, :class => JamRuby::Band do
sequence(:name) { |n| "Band" }
biography "Established 1978"
city "Apex"
state "NC"
country "USA"
2012-11-12 12:59:43 +00:00
end
factory :join_request, :class => JamRuby::JoinRequest do
text 'let me in to the session!'
end
factory :genre, :class => JamRuby::Genre do
description { |n| "Genre #{n}" }
end
factory :instrument, :class => JamRuby::Instrument do
description { |n| "Instrument #{n}" }
end
factory :artifact_update, :class => JamRuby::ArtifactUpdate do
sequence(:version) { |n| "0.1.#{n}" }
uri { fixture_file_upload("#{Rails.root.to_s}/spec/fixtures/files/jkclient.exe", "application/x-msdownload") }
product { "JamClient/Win32" }
environment { "public" }
sha1 { "blurp" }
end
2013-03-08 06:45:06 +00:00
factory :musician_instrument, :class=> JamRuby::MusicianInstrument do
instrument { Instrument.find('electric guitar') }
proficiency_level 1
priority 0
end
end