FactoryGirl.define do
  factory :user, :class => JamRuby::User do
    sequence(:email) { |n| "person_#{n}@example.com"}
    sequence(:first_name)  { |n| "Person" }
    sequence(:last_name)  { |n| "#{n}" }
    password "foobar"
    password_confirmation "foobar"
    email_confirmed true
    musician true
    city "Apex"
    state "NC"
    country "USA"
    terms_of_service true


    factory :admin do
      admin true
    end

    before(:create) do |user|
      user.musician_instruments << FactoryGirl.build(:musician_instrument, user: user)
    end
  end

  factory :music_session, :class => JamRuby::MusicSession do
    sequence(:description) { |n| "Jam Session #{n}" }
        fan_chat true
    fan_access true
    approval_required false
    musician_access true
    legal_terms true
  end

  factory :connection, :class => JamRuby::Connection do
    ip_address "1.1.1.1"
    as_musician true
  end

  factory :instrument, :class => JamRuby::Instrument do
    description { |n| "Instrument #{n}" }
  end

  factory :musician_instrument, :class=> JamRuby::MusicianInstrument do
    instrument { Instrument.find('electric guitar') }
    proficiency_level 1
    priority 0
  end
end
