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

    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
  end
  factory :artifact_update, :class => JamRuby::ArtifactUpdate do
    sequence(:version) { |n| "0.1.#{n}" }
    uri { "http://somewhere/jkclient.msi" }
    product { "JamClient/Win32" }
    environment { "public" }
    sha1 { "blurp" }
  end

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

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

end
