VRFS-736 filling out remaining subtypes

This commit is contained in:
Jonathan Kolyer 2014-05-21 06:20:15 +00:00
parent b998b87a01
commit 9ad0badff1
2 changed files with 253 additions and 3 deletions

View File

@ -118,11 +118,11 @@ module JamRuby
when :sess_notrecord
return "#{tbl}.first_real_music_session_at IS NOT NULL AND #{tbl}.first_recording_at IS NULL"
when :reg_notinvite
return "#{tbl}.first_invited_at IS NOT NULL"
return "#{tbl}.first_invited_at IS NULL"
when :reg_notconnect
return "#{tbl}.first_friended_at IS NOT NULL"
return "#{tbl}.first_friended_at IS NULL"
when :reg_notlike
return "#{tbl}.first_social_promoted_at IS NOT NULL"
return "#{tbl}.first_social_promoted_at IS NULL"
end
''
end

View File

@ -217,5 +217,255 @@ describe EmailBatch do
loops_bunch_of_users(batchp, users)
end
end
describe 'client_run_notgear' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :client_run_notgear)
}
let(:user_) { FactoryGirl.create(:user, :first_ran_client_at => Time.now) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past,
:first_ran_client_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user, :first_ran_client_at => Time.now) }
loops_bunch_of_users(batchp, users)
end
end
describe 'gear_notsess' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :gear_notsess)
}
let(:user_) { FactoryGirl.create(:user, :first_certified_gear_at => Time.now) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past,
:first_certified_gear_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user, :first_certified_gear_at => Time.now) }
loops_bunch_of_users(batchp, users)
end
end
describe 'sess_notgood' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :sess_notgood)
}
let(:user_) { FactoryGirl.create(:user, :first_real_music_session_at => Time.now) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past,
:first_real_music_session_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user, :first_real_music_session_at => Time.now) }
loops_bunch_of_users(batchp, users)
end
end
describe 'sess_notrecord' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :sess_notrecord)
}
let(:user_) { FactoryGirl.create(:user, :first_real_music_session_at => Time.now) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past,
:first_real_music_session_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user, :first_real_music_session_at => Time.now) }
loops_bunch_of_users(batchp, users)
end
end
describe 'reg_notinvite' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notinvite)
}
let(:user_) { FactoryGirl.create(:user) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user) }
loops_bunch_of_users(batchp, users)
end
end
describe 'reg_notconnect' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notconnect)
}
let(:user_) { FactoryGirl.create(:user) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user) }
loops_bunch_of_users(batchp, users)
end
end
describe 'reg_notlike' do
# before { pending }
let(:batchp) {
FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notlike)
}
let(:user_) { FactoryGirl.create(:user) }
let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days }
let(:user_existing) {
FactoryGirl.create(:user,
:created_at => date_in_past)
}
after(:each) do
batchp.clear_batch_sets!
Timecop.return
end
it 'sends one email' do
pending
sends_one_email(user_existing, batchp)
end
it 'handles new users' do
handles_new_users(batchp, user_)
end
it 'handles existing users' do
handles_existing_users(batchp, user_existing)
end
it 'skips some days' do
skips_some_days(batchp, user_)
end
it 'loops bunch of users' do
users = []
20.times { |nn| users << FactoryGirl.create(:user) }
loops_bunch_of_users(batchp, users)
end
end
end
end