VRFS-4189 - non free jamtrack support
This commit is contained in:
parent
d32cecaa03
commit
c5f7711850
|
|
@ -5,7 +5,7 @@
|
|||
= f.input :description, :input_html => { :rows=>5, :maxlength=>1000 }
|
||||
= f.input :plan_code, :label=>'Recurly Plan Code', :required=>true, :hint => 'Must match plan code in Recurly'
|
||||
//= f.input :initial_play_silence, :label => 'Initial Play Silence (seconds)'
|
||||
= f.input :time_signature, collection: JamRuby::JamTrack::TIME_SIGNATURES, include_blank: true
|
||||
= f.input :allow_free, :label => "Allow Free to new Users?"
|
||||
= f.input :status, collection: JamRuby::JamTrack::STATUS, include_blank: false, hint: 'Only set to Production when end users should be able to purchase this JamTrack'
|
||||
= f.input :recording_type, collection: JamRuby::JamTrack::RECORDING_TYPE, include_blank: false
|
||||
= f.input :original_artist, :input_html => { :rows=>1, :maxlength=>1000 }
|
||||
|
|
|
|||
|
|
@ -362,4 +362,5 @@ jamclass_report.sql
|
|||
jamblasters_network.sql
|
||||
immediate_recordings.sql
|
||||
nullable_user_id_jamblaster.sql
|
||||
rails4_migration.sql
|
||||
rails4_migration.sql
|
||||
non_free_jamtracks.sql
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE jam_tracks ADD COLUMN allow_free BOOLEAN DEFAULT TRUE;
|
||||
|
||||
ALTER TABLE lesson_package_purchases DROP CONSTRAINT lesson_package_purchases_lesson_booking_id_fkey;
|
||||
ALTER TABLE lesson_package_purchases ADD CONSTRAINT lesson_package_purchases_lesson_booking_id_fkey FOREIGN KEY (lesson_booking_id) REFERENCES lesson_bookings(id) ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE lesson_booking_slots DROP CONSTRAINT lesson_booking_slots_lesson_booking_id_fkey;
|
||||
ALTER TABLE lesson_booking_slots ADD CONSTRAINT lesson_booking_slots_lesson_booking_id_fkey FOREIGN KEY (lesson_booking_id) REFERENCES lesson_bookings(id) ON DELETE SET NULL;
|
||||
|
|
@ -9,7 +9,7 @@ module JamRuby
|
|||
class CorpMailer < ActionMailer::Base
|
||||
include SendGrid
|
||||
|
||||
layout "user_mailer"
|
||||
layout "raw_mailer"
|
||||
|
||||
DEFAULT_SENDER = "JamKazam <noreply@jamkazam.com>"
|
||||
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ module JamRuby
|
|||
def friend_request(user, msg, friend_request_id)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "You have a new friend request on JamKazam"
|
||||
unique_args = {:type => "friend_request"}
|
||||
|
|
@ -187,6 +189,8 @@ module JamRuby
|
|||
def friend_request_accepted(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "You have a new friend on JamKazam"
|
||||
unique_args = {:type => "friend_request_accepted"}
|
||||
|
|
@ -207,6 +211,8 @@ module JamRuby
|
|||
def new_user_follower(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "You have a new follower on JamKazam"
|
||||
unique_args = {:type => "new_user_follower"}
|
||||
|
|
@ -227,6 +233,8 @@ module JamRuby
|
|||
def new_band_follower(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "Your band has a new follower on JamKazam"
|
||||
unique_args = {:type => "new_band_follower"}
|
||||
|
|
@ -247,6 +255,9 @@ module JamRuby
|
|||
def session_invitation(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "You have been invited to a session on JamKazam"
|
||||
unique_args = {:type => "session_invitation"}
|
||||
|
|
@ -267,6 +278,9 @@ module JamRuby
|
|||
def musician_session_join(user, msg, session_id)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Someone you know is in a session on JamKazam"
|
||||
unique_args = {:type => "musician_session_join"}
|
||||
|
|
@ -287,6 +301,9 @@ module JamRuby
|
|||
def scheduled_session_invitation(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Session Invitation"
|
||||
unique_args = {:type => "scheduled_session_invitation"}
|
||||
|
|
@ -309,6 +326,7 @@ module JamRuby
|
|||
def scheduled_session_rsvp(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
email = user.email
|
||||
subject = "Session RSVP"
|
||||
unique_args = {:type => "scheduled_session_rsvp"}
|
||||
|
|
@ -331,6 +349,9 @@ module JamRuby
|
|||
def scheduled_session_rsvp_approved(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Session RSVP Approved"
|
||||
unique_args = {:type => "scheduled_session_rsvp_approved"}
|
||||
|
|
@ -353,6 +374,9 @@ module JamRuby
|
|||
def scheduled_session_rsvp_cancelled(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Session RSVP Cancelled"
|
||||
unique_args = {:type => "scheduled_session_rsvp_cancelled"}
|
||||
|
|
@ -375,6 +399,9 @@ module JamRuby
|
|||
def scheduled_session_rsvp_cancelled_org(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Your Session RSVP Cancelled"
|
||||
unique_args = {:type => "scheduled_session_rsvp_cancelled_org"}
|
||||
|
|
@ -397,6 +424,8 @@ module JamRuby
|
|||
def scheduled_session_cancelled(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "Session Cancelled"
|
||||
unique_args = {:type => "scheduled_session_cancelled"}
|
||||
|
|
@ -419,6 +448,9 @@ module JamRuby
|
|||
def scheduled_session_rescheduled(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Session Rescheduled"
|
||||
unique_args = {:type => "scheduled_session_rescheduled"}
|
||||
|
|
@ -439,12 +471,16 @@ module JamRuby
|
|||
end
|
||||
|
||||
def scheduled_session_reminder_upcoming(user, session)
|
||||
@user = user
|
||||
|
||||
subject = "Your JamKazam session starts in 1 hour!"
|
||||
unique_args = {:type => "scheduled_session_reminder_upcoming"}
|
||||
send_scheduled_session_reminder(user, session, subject, unique_args)
|
||||
end
|
||||
|
||||
def scheduled_session_reminder_day(user, session)
|
||||
@user = user
|
||||
|
||||
subject = "JamKazam Session Reminder"
|
||||
unique_args = {:type => "scheduled_session_reminder_day"}
|
||||
send_scheduled_session_reminder(user, session, subject, unique_args)
|
||||
|
|
@ -473,6 +509,9 @@ module JamRuby
|
|||
def scheduled_session_comment(target_user, sender, msg, comment, session)
|
||||
return if !target_user.subscribe_email
|
||||
|
||||
@user = target_user
|
||||
|
||||
|
||||
email = target_user.email
|
||||
subject = "New Session Comment"
|
||||
unique_args = {:type => "scheduled_session_comment"}
|
||||
|
|
@ -520,6 +559,8 @@ module JamRuby
|
|||
subject = "A band that you follow has joined a session"
|
||||
unique_args = {:type => "band_session_join"}
|
||||
|
||||
@user = user
|
||||
|
||||
@body = msg
|
||||
@session_url = "#{APP_CONFIG.external_root_url}/sessions/#{session_id}"
|
||||
sendgrid_category "Notification"
|
||||
|
|
@ -537,6 +578,9 @@ module JamRuby
|
|||
def musician_recording_saved(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "A musician has saved a new recording on JamKazam"
|
||||
unique_args = {:type => "musician_recording_saved"}
|
||||
|
|
@ -557,6 +601,9 @@ module JamRuby
|
|||
def band_recording_saved(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "A band has saved a new recording on JamKazam"
|
||||
unique_args = {:type => "band_recording_saved"}
|
||||
|
|
@ -577,6 +624,8 @@ module JamRuby
|
|||
def band_invitation(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "You have been invited to join a band on JamKazam"
|
||||
unique_args = {:type => "band_invitation"}
|
||||
|
|
@ -597,6 +646,9 @@ module JamRuby
|
|||
def band_invitation_accepted(user, msg)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
|
||||
email = user.email
|
||||
subject = "Your band invitation was accepted"
|
||||
unique_args = {:type => "band_invitation_accepted"}
|
||||
|
|
@ -618,6 +670,8 @@ module JamRuby
|
|||
def text_message(user, sender_id, sender_name, sender_photo_url, message)
|
||||
return if !user.subscribe_email
|
||||
|
||||
@user = user
|
||||
|
||||
email = user.email
|
||||
subject = "Message from #{sender_name}"
|
||||
unique_args = {:type => "text_message"}
|
||||
|
|
@ -640,6 +694,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_lesson_request(lesson_booking)
|
||||
@user = lesson_booking.user
|
||||
email = lesson_booking.user.email
|
||||
subject = "You have sent a lesson request to #{lesson_booking.teacher.name}!"
|
||||
unique_args = {:type => "student_lesson_request"}
|
||||
|
|
@ -666,6 +721,7 @@ module JamRuby
|
|||
unique_args = {:type => "teacher_lesson_request"}
|
||||
|
||||
@sender = lesson_booking.user
|
||||
@user = lesson_booking.user
|
||||
@lesson_booking = lesson_booking
|
||||
|
||||
sendgrid_category "Notification"
|
||||
|
|
@ -693,6 +749,7 @@ module JamRuby
|
|||
end
|
||||
@lesson_session = lesson_session
|
||||
@message = message
|
||||
@user = lesson_session.student
|
||||
email = lesson_session.student.email
|
||||
unique_args = {:type => "student_lesson_accepted"}
|
||||
|
||||
|
|
@ -722,6 +779,7 @@ module JamRuby
|
|||
|
||||
@lesson_session = lesson_session
|
||||
@message = message
|
||||
@user = lesson_session.teacher
|
||||
email = lesson_session.school_and_teacher
|
||||
unique_args = {:type => "teacher_lesson_accepted"}
|
||||
|
||||
|
|
@ -750,6 +808,7 @@ module JamRuby
|
|||
end
|
||||
@lesson_session = lesson_session
|
||||
@message = message
|
||||
@user = lesson_session.student
|
||||
email = lesson_session.student.email
|
||||
unique_args = {:type => "student_lesson_accepted"}
|
||||
|
||||
|
|
@ -777,6 +836,8 @@ module JamRuby
|
|||
subject = "All lesson times changed with #{lesson_session.student.name}!"
|
||||
end
|
||||
|
||||
|
||||
@user = lesson_session.teacher
|
||||
@lesson_session = lesson_session
|
||||
@message = message
|
||||
email = lesson_session.school_and_teacher
|
||||
|
|
@ -797,8 +858,10 @@ module JamRuby
|
|||
def teacher_scheduled_jamclass_invitation(user, msg, session)
|
||||
|
||||
email = user.email
|
||||
|
||||
@subject = "#{session.lesson_session.lesson_booking.display_type2.capitalize} JamClass Scheduled with #{session.lesson_session.student.name}"
|
||||
unique_args = {:type => "scheduled_jamclass_invitation"}
|
||||
@user = session.lesson_session.student
|
||||
@student = session.lesson_session.student
|
||||
@teacher = session.lesson_session.teacher
|
||||
@body = msg
|
||||
|
|
@ -819,11 +882,11 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_scheduled_jamclass_invitation(user, msg, session)
|
||||
return if !user.subscribe_email
|
||||
|
||||
email = user.email
|
||||
@subject = "#{session.lesson_session.lesson_booking.display_type2.capitalize} JamClass Scheduled with #{session.lesson_session.teacher.name}"
|
||||
unique_args = {:type => "scheduled_jamclass_invitation"}
|
||||
@user = session.lesson_session.student
|
||||
@student = session.lesson_session.student
|
||||
@teacher = session.lesson_session.teacher
|
||||
@body = msg
|
||||
|
|
@ -846,6 +909,7 @@ module JamRuby
|
|||
# teacher proposed counter time; so send msg to the student
|
||||
def student_lesson_counter(lesson_session, slot)
|
||||
|
||||
@user = lesson_session.student
|
||||
email = lesson_session.student.email
|
||||
subject = "Instructor has proposed a different time for your lesson"
|
||||
unique_args = {:type => "student_lesson_counter"}
|
||||
|
|
@ -871,6 +935,7 @@ module JamRuby
|
|||
# student proposed counter time; so send msg to the teacher
|
||||
def teacher_lesson_counter(lesson_session, slot)
|
||||
|
||||
@user = lesson_session.teacher
|
||||
email = lesson_session.school_over_teacher
|
||||
subject = "Student has proposed a different time for their lesson"
|
||||
unique_args = {:type => "teacher_lesson_counter"}
|
||||
|
|
@ -901,6 +966,7 @@ module JamRuby
|
|||
@session_date = lesson_session.slot.pretty_scheduled_start(true)
|
||||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
@user = lesson_session.teacher
|
||||
email = lesson_session.school_and_teacher
|
||||
if @lesson_session.student_missed
|
||||
subject = "You will be paid for your lesson with #{@student.name}"
|
||||
|
|
@ -934,6 +1000,7 @@ module JamRuby
|
|||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
|
||||
@user = lesson_session.student
|
||||
email = @student.email
|
||||
subject = "You have used #{@student.used_test_drives} of #{@student.total_test_drives} TestDrive lesson credits"
|
||||
unique_args = {:type => "student_test_drive_success"}
|
||||
|
|
@ -951,6 +1018,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def teacher_test_drive_no_bill(lesson_session)
|
||||
@user = lesson_session.teacher
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -976,6 +1044,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_test_drive_no_bill(lesson_session)
|
||||
@user = lesson_session.student
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1003,6 +1072,7 @@ module JamRuby
|
|||
# successfully completed, but no more test drives left
|
||||
def student_test_drive_lesson_done(lesson_session)
|
||||
|
||||
@user = lesson_session.student
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1028,6 +1098,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_lesson_normal_no_bill(lesson_session)
|
||||
@user = lesson_session.student
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1053,6 +1124,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def teacher_lesson_normal_no_bill(lesson_session)
|
||||
@user = lesson_session.teacher
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1077,6 +1149,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_lesson_normal_done(lesson_session)
|
||||
@user = lesson_session.student
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1102,6 +1175,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def teacher_lesson_normal_done(lesson_session)
|
||||
@user = lesson_session.teacher
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1126,6 +1200,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def student_unable_charge(lesson_session)
|
||||
@user = lesson_session.student
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1154,6 +1229,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def teacher_unable_charge(lesson_session)
|
||||
@user = lesson_session.teacher
|
||||
@student = lesson_session.student
|
||||
@teacher = lesson_session.teacher
|
||||
@session_name = lesson_session.music_session.name
|
||||
|
|
@ -1179,6 +1255,7 @@ module JamRuby
|
|||
|
||||
def student_unable_charge_monthly(lesson_package_purchase)
|
||||
lesson_booking = lesson_package_purchase.lesson_booking
|
||||
@user = lesson_booking.student
|
||||
@student = lesson_booking.student
|
||||
@teacher = lesson_booking.teacher
|
||||
@lesson_package_purchase = lesson_package_purchase
|
||||
|
|
@ -1211,6 +1288,7 @@ module JamRuby
|
|||
|
||||
def teacher_unable_charge_monthly(lesson_package_purchase)
|
||||
lesson_booking = lesson_package_purchase.lesson_booking
|
||||
@user = lesson_booking.teacher
|
||||
@student = lesson_booking.student
|
||||
@teacher = lesson_booking.teacher
|
||||
@lesson_package_purchase = lesson_package_purchase
|
||||
|
|
@ -1244,6 +1322,7 @@ module JamRuby
|
|||
|
||||
def student_lesson_monthly_charged(lesson_package_purchase)
|
||||
lesson_booking = lesson_package_purchase.lesson_booking
|
||||
@user = lesson_booking.student
|
||||
@student = lesson_booking.student
|
||||
@teacher = lesson_booking.teacher
|
||||
@lesson_package_purchase = lesson_package_purchase
|
||||
|
|
@ -1271,6 +1350,7 @@ module JamRuby
|
|||
|
||||
def teacher_lesson_monthly_charged(lesson_package_purchase)
|
||||
lesson_booking = lesson_package_purchase.lesson_booking
|
||||
@user = lesson_booking.teacher
|
||||
@student = lesson_booking.student
|
||||
@teacher = lesson_booking.teacher
|
||||
@lesson_package_purchase = lesson_package_purchase
|
||||
|
|
@ -1312,6 +1392,7 @@ module JamRuby
|
|||
@name = @teacher.first_name || 'Anonymous'
|
||||
@student = @distribution.student
|
||||
email = @distribution.target.lesson_booking.school_over_teacher
|
||||
@user = @teacher
|
||||
|
||||
if @school
|
||||
if @distribution.is_test_drive?
|
||||
|
|
@ -1359,6 +1440,7 @@ module JamRuby
|
|||
@student = @distribution.student
|
||||
@name = @payable_teacher.first_name || 'Anonymous'
|
||||
email = @distribution.target.lesson_booking.school_over_teacher
|
||||
@user = @teacher
|
||||
|
||||
@card_declined = teacher_payment.is_card_declined?
|
||||
@card_expired = teacher_payment.is_card_expired?
|
||||
|
|
@ -1410,6 +1492,7 @@ module JamRuby
|
|||
@payable_teacher = @school.owner
|
||||
@name = @payable_teacher.first_name || 'Anonymous'
|
||||
@student = @distribution.student
|
||||
@user = @teacher
|
||||
email = @payable_teacher.email
|
||||
|
||||
if @distribution.is_test_drive?
|
||||
|
|
@ -1445,6 +1528,7 @@ module JamRuby
|
|||
@session_date = lesson_session.slot.pretty_scheduled_start(true)
|
||||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
@user = @student
|
||||
|
||||
email = @student.email
|
||||
subject = "Your JamClass lesson today with #{@teacher.first_name}"
|
||||
|
|
@ -1470,6 +1554,7 @@ module JamRuby
|
|||
@session_date = lesson_session.slot.pretty_scheduled_start(true)
|
||||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
@user = @student
|
||||
|
||||
email = @student.email
|
||||
subject = "Your lesson with #{@teacher.name} will not be billed"
|
||||
|
|
@ -1497,6 +1582,7 @@ module JamRuby
|
|||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
email = @student.email
|
||||
@user = @student
|
||||
@subject = "We're sorry your lesson request has been declined"
|
||||
unique_args = {:type => "student_lesson_booking_declined"}
|
||||
|
||||
|
|
@ -1521,6 +1607,7 @@ module JamRuby
|
|||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
email = @student.email
|
||||
@user = @student
|
||||
@subject = "Your lesson has been canceled"
|
||||
unique_args = {:type => "student_lesson_booking_canceled"}
|
||||
|
||||
|
|
@ -1544,7 +1631,7 @@ module JamRuby
|
|||
@session_name = @lesson_session.music_session.name
|
||||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
|
||||
@user = @teacher
|
||||
email = @lesson_booking.school_and_teacher
|
||||
@subject = "Your lesson has been canceled"
|
||||
unique_args = {:type => "teacher_lesson_booking_canceled"}
|
||||
|
|
@ -1570,6 +1657,7 @@ module JamRuby
|
|||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
email = @student.email
|
||||
@user = @student
|
||||
@subject = "Your lesson has been canceled"
|
||||
unique_args = {:type => "student_lesson_canceled"}
|
||||
|
||||
|
|
@ -1594,6 +1682,7 @@ module JamRuby
|
|||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
|
||||
@user = @teacher
|
||||
email = @lesson_booking.school_and_teacher
|
||||
@subject = "Your lesson has been canceled"
|
||||
unique_args = {:type => "teacher_lesson_canceled"}
|
||||
|
|
@ -1657,7 +1746,7 @@ module JamRuby
|
|||
@session_name = @lesson_session.music_session.name
|
||||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
|
||||
@user = @target
|
||||
email = @lesson_session.school_over_teacher
|
||||
@subject = "#{@sender.name} has sent you a message about a lesson"
|
||||
unique_args = {:type => "lesson_chat"}
|
||||
|
|
@ -1679,7 +1768,7 @@ module JamRuby
|
|||
@teacher = lesson_session.teacher
|
||||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
|
||||
@user = @student
|
||||
email = @student.email
|
||||
@subject = "Instructor's time proposal is still awaiting your response"
|
||||
unique_args = {:type => "student_counter_reminder"}
|
||||
|
|
@ -1705,6 +1794,7 @@ module JamRuby
|
|||
@session_date = lesson_session.slot.pretty_scheduled_start(true)
|
||||
@session_url = lesson_session.web_url
|
||||
@lesson_session = lesson_session
|
||||
@user = @teacher
|
||||
email = lesson_session.school_over_teacher
|
||||
@subject = "Student #{@student.name}'s time proposal is still awaiting your response"
|
||||
unique_args = {:type => "teacher_counter_reminder"}
|
||||
|
|
@ -1731,6 +1821,7 @@ module JamRuby
|
|||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
|
||||
@user = @teacher
|
||||
email = @teacher.email
|
||||
@subject = "Your lesson with #{@student.first_name} on JamKazam is starting soon"
|
||||
unique_args = {:type => "send_starting_notice_teacher"}
|
||||
|
|
@ -1755,7 +1846,7 @@ module JamRuby
|
|||
@session_name = @lesson_session.music_session.name
|
||||
@session_description = @lesson_session.music_session.description
|
||||
@session_date = @lesson_session.slot.pretty_scheduled_start(true)
|
||||
|
||||
@user = @student
|
||||
email = @student.email
|
||||
@subject = "Your lesson with #{@teacher.first_name} on JamKazam is starting soon"
|
||||
unique_args = {:type => "send_starting_notice_student"}
|
||||
|
|
@ -1777,7 +1868,7 @@ module JamRuby
|
|||
@lesson_session = lesson_session
|
||||
@attachment = attachment
|
||||
|
||||
|
||||
@user = target
|
||||
email = target.email
|
||||
@subject = "An attachment has been added to your lesson by #{sender.name}"
|
||||
unique_args = {:type => "lesson_attachment"}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<td align="left">
|
||||
|
||||
<!-- CALL OUT BOX -->
|
||||
<p style="margin-top:0px"><font size="2" color="#7FACBA" face="Arial, Helvetica, sans-serif">This email was sent to you because you have an account at <a style="color: #ffcc00;" href="http://www.jamkazam.com">JamKazam</a>. Click <a style="color: #ffcc00;" href="http://www.jamkazam.com/unsubscribe/#{@user.unsubscribe_token}">here to unsubscribe</a> and update your profile settings.
|
||||
<p style="margin-top:0px"><font size="2" color="#7FACBA" face="Arial, Helvetica, sans-serif">This email was sent to you because you have an account at <a style="color: #ffcc00;" href="http://www.jamkazam.com">JamKazam</a>. Click <a style="color: #ffcc00;" href="https://www.jamkazam.com/unsubscribe/<%= @user.unsubscribe_token %>">here to unsubscribe</a>.
|
||||
</font></p>
|
||||
</td></tr></table>
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class JamRuby::AffiliatePartner < ActiveRecord::Base
|
|||
oo.partner_name = params[:partner_name].try(:strip)
|
||||
oo.partner_user = user if user # user is not required
|
||||
oo.entity_type = params[:entity_type] || ENTITY_TYPES.first
|
||||
signed_legalese
|
||||
oo.signed_at = Time.now
|
||||
oo.save
|
||||
oo
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ module JamRuby
|
|||
ShoppingCart.where(anonymous_user_id: @id).order('created_at DESC')
|
||||
end
|
||||
|
||||
def mixed_cart
|
||||
Sale.is_mixed(shopping_carts)
|
||||
end
|
||||
|
||||
def destroy_all_shopping_carts
|
||||
ShoppingCart.destroy_all(anonymous_user_id: @id)
|
||||
|
|
@ -57,5 +60,6 @@ module JamRuby
|
|||
def reload
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module JamRuby
|
||||
class Charge < ActiveRecord::Base
|
||||
class Charge < ActiveRecord::Base
|
||||
|
||||
attr_accessor :stripe_charge
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ module JamRuby
|
|||
|
||||
subject = "Unable to charge user #{charged_user.email} for lesson #{self.id} (stripe)"
|
||||
body = "user=#{charged_user.email}\n\nbilling_error_reason=#{billing_error_reason}\n\nbilling_error_detail = #{billing_error_detail}"
|
||||
AdminMailer.alerts({subject: subject, body: body}).deliver
|
||||
AdminMailer.alerts({subject: subject, body: body}).deliver_now
|
||||
do_send_unable_charge
|
||||
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ module JamRuby
|
|||
|
||||
# a nil purpose means 'normal chat', which is the only time we should send an email
|
||||
if !target.online? && purpose.nil? && message.present?
|
||||
UserMailer.lesson_chat(chat_msg).deliver!
|
||||
UserMailer.lesson_chat(chat_msg).deliver_now
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def self.alert_user_sharer(user)
|
||||
violation = check_user_sharer(APP_CONFIG.max_user_ip_address, user.id).first
|
||||
violation = check_user_sharer(APP_CONFIG.max_user_ip_address, user.id)[0]
|
||||
|
||||
if violation
|
||||
body = "User has downloaded from too many IP addresses #{user.id}\n"
|
||||
|
|
@ -106,7 +106,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
if !IpWhitelist.listed(remote_ip)
|
||||
violation = check_freebie_snarfer(APP_CONFIG.max_multiple_users_same_ip, remote_ip).first
|
||||
violation = check_freebie_snarfer(APP_CONFIG.max_multiple_users_same_ip, remote_ip)[0]
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,31 +15,30 @@ module JamRuby
|
|||
validates :sender, :presence => true
|
||||
validates :receiver, :presence => true
|
||||
validates :music_session, :presence => true
|
||||
|
||||
|
||||
validate :require_sender_in_music_session, :require_are_friends_or_requested_to_join_or_teacher
|
||||
|
||||
private
|
||||
|
||||
def require_sender_in_music_session
|
||||
if music_session && !music_session.part_of_session?(sender)
|
||||
errors.add(:music_session, MEMBERSHIP_REQUIRED_OF_MUSIC_SESSION)
|
||||
errors.add(:music_session, MEMBERSHIP_REQUIRED_OF_MUSIC_SESSION)
|
||||
end
|
||||
end
|
||||
|
||||
def require_are_friends_or_requested_to_join_or_teacher
|
||||
if !join_request.nil? && (join_request.user != receiver || join_request.music_session != music_session)
|
||||
errors.add(:join_request, JOIN_REQUEST_IS_NOT_FOR_RECEIVER_AND_MUSIC_SESSION )
|
||||
errors.add(:join_request, JOIN_REQUEST_IS_NOT_FOR_RECEIVER_AND_MUSIC_SESSION)
|
||||
elsif music_session.is_lesson?
|
||||
if (receiver != music_session.lesson_session.teacher)
|
||||
errors.add(:receiver, INVITATION_NOT_TEACHER_VALIDATION_ERROR)
|
||||
end
|
||||
elsif join_request.nil?
|
||||
# we only check for friendship requirement if this was not in response to a join_request
|
||||
if !receiver.friends.exists?(sender.id) && (music_session.is_lesson? && receiver != music_session.lesson_session.teacher)
|
||||
if !receiver.friends.exists?(sender.id)
|
||||
errors.add(:receiver, FRIENDSHIP_REQUIRED_VALIDATION_ERROR)
|
||||
elsif (music_session.is_lesson? && receiver != music_session.lesson_session.teacher)
|
||||
errors.add(:receiver, INVITATION_NOT_TEACHER_VALIDATION_ERROR)
|
||||
end
|
||||
# we only check for friendship requirement if this was not in response to a join_request and not a lesson
|
||||
if !receiver.friends.exists?(sender.id)
|
||||
errors.add(:receiver, FRIENDSHIP_REQUIRED_VALIDATION_ERROR)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module JamRuby
|
|||
:reproduction_royalty, :public_performance_royalty, :reproduction_royalty_amount,
|
||||
:licensor_royalty_amount, :pro_royalty_amount, :plan_code, :initial_play_silence, :jam_track_tracks_attributes,
|
||||
:jam_track_tap_ins_attributes, :genre_ids, :version, :jmep_json, :jmep_text, :pro_ascap, :pro_bmi, :pro_sesac, :duration,
|
||||
:server_fixation_date, :hfa_license_status, :hfa_license_desired, :alternative_license_status, :hfa_license_number, :hfa_song_code, :album_title, :year, as: :admin
|
||||
:server_fixation_date, :hfa_license_status, :hfa_license_desired, :alternative_license_status, :hfa_license_number, :hfa_song_code, :album_title, :year, :allow_free, as: :admin
|
||||
|
||||
validates :name, presence: true, length: {maximum: 200}
|
||||
validates :plan_code, presence: true, uniqueness: true, length: {maximum: 50 }
|
||||
|
|
@ -64,9 +64,9 @@ module JamRuby
|
|||
|
||||
has_many :owners, :through => :jam_track_rights, :class_name => "JamRuby::User", :source => :user
|
||||
|
||||
has_many :playing_sessions, :class_name => "JamRuby::ActiveMusicSession"
|
||||
has_many :playing_sessions, :class_name => "JamRuby::ActiveMusicSession", :dependent => :destroy
|
||||
|
||||
has_many :recordings, :class_name => "JamRuby::Recording"
|
||||
has_many :recordings, :class_name => "JamRuby::Recording", :dependent => :destroy
|
||||
|
||||
# VRFS-2916 jam_tracks.id is varchar: REMOVE
|
||||
# has_many :plays, :class_name => "JamRuby::PlayablePlay", :foreign_key => :jam_track_id, :dependent => :destroy
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module JamRuby
|
|||
|
||||
belongs_to :lesson_booking, class_name: "JamRuby::LessonBooking"
|
||||
belongs_to :lesson_session, class_name: "JamRuby::LessonSession"
|
||||
belongs_to :proposer, class_name: "JamRuby::User"
|
||||
belongs_to :proposer, class_name: "JamRuby::User", inverse_of: :proposed_slots, foreign_key: :proposer_id
|
||||
has_one :defaulted_booking, class_name: "JamRuby::LessonBooking", foreign_key: :default_slot_id, inverse_of: :default_slot
|
||||
has_one :countered_booking, class_name: "JamRuby::LessonBooking", foreign_key: :counter_slot_id, inverse_of: :counter_slot
|
||||
has_one :countered_lesson, class_name: "JamRuby::LessonSession", foreign_key: :counter_slot_id, inverse_of: :counter_slot
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ module JamRuby
|
|||
belongs_to :teacher, class_name: "JamRuby::User"
|
||||
belongs_to :lesson_booking, class_name: "JamRuby::LessonBooking"
|
||||
belongs_to :lesson_payment_charge, class_name: "JamRuby::LessonPaymentCharge", foreign_key: :charge_id
|
||||
has_one :lesson_session, class_name: "JamRuby::LessonSession", dependent: :destroy
|
||||
has_one :teacher_distribution, class_name: "JamRuby::TeacherDistribution"
|
||||
|
||||
has_one :sale_line_item, class_name: "JamRuby::SaleLineItem"
|
||||
has_one :sale_line_item, class_name: "JamRuby::SaleLineItem", dependent: :destroy
|
||||
|
||||
validates :user, presence: true
|
||||
validates :lesson_package_type, presence: true
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ module JamRuby
|
|||
belongs_to :slot, class_name: "JamRuby::LessonBookingSlot", foreign_key: :slot_id, :dependent => :destroy
|
||||
belongs_to :lesson_payment_charge, class_name: "JamRuby::LessonPaymentCharge", foreign_key: :charge_id
|
||||
belongs_to :counter_slot, class_name: "JamRuby::LessonBookingSlot", foreign_key: :counter_slot_id, inverse_of: :countered_lesson, :dependent => :destroy
|
||||
has_one :teacher_distribution, class_name: "JamRuby::TeacherDistribution"
|
||||
has_one :teacher_distribution, class_name: "JamRuby::TeacherDistribution", dependent: :destroy
|
||||
has_many :lesson_booking_slots, class_name: "JamRuby::LessonBookingSlot"
|
||||
has_many :notifications, :class_name => "JamRuby::Notification", :foreign_key => "lesson_session_id"
|
||||
has_many :chat_messages, :class_name => "JamRuby::ChatMessage", :foreign_key => "lesson_session_id"
|
||||
|
|
@ -134,9 +134,9 @@ module JamRuby
|
|||
.where("? > (COALESCE(lesson_bookings.countered_at, lesson_bookings.sent_notices_at)) + (INTERVAL '24 hours')", Time.now).each do |music_session|
|
||||
lesson_session = music_session.lesson_session
|
||||
if lesson_session.student_last_proposed?
|
||||
UserMailer.teacher_counter_reminder(lesson_session).deliver!
|
||||
UserMailer.teacher_counter_reminder(lesson_session).deliver_now
|
||||
else
|
||||
UserMailer.student_counter_reminder(lesson_session).deliver!
|
||||
UserMailer.student_counter_reminder(lesson_session).deliver_now
|
||||
end
|
||||
lesson_session.lesson_booking.sent_counter_reminder = true
|
||||
lesson_session.lesson_booking.save(validate: false)
|
||||
|
|
@ -366,7 +366,6 @@ module JamRuby
|
|||
end
|
||||
|
||||
def recurring_completed
|
||||
puts "RECURRING COMPLETED #{success}"
|
||||
if success
|
||||
|
||||
if lesson_booking.is_monthly_payment?
|
||||
|
|
@ -424,7 +423,6 @@ module JamRuby
|
|||
else
|
||||
if !sent_notices
|
||||
if !school_on_school?
|
||||
puts "STUDENT NO BILL SENT #{success}"
|
||||
UserMailer.student_lesson_normal_no_bill(self).deliver_now
|
||||
UserMailer.teacher_lesson_normal_no_bill(self).deliver_now
|
||||
end
|
||||
|
|
@ -820,11 +818,9 @@ module JamRuby
|
|||
self.counter_slot = slot
|
||||
#end
|
||||
if self.save
|
||||
puts "SAVING OK"
|
||||
#if update_all && !lesson_booking.counter(self, proposer, slot)
|
||||
if !lesson_booking.counter(self, proposer, slot)
|
||||
response = lesson_booking
|
||||
puts "ROLLBACK"
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ module JamRuby
|
|||
|
||||
def delete_s3_files
|
||||
s3_manager.delete(filename(type=default_type)) if self[:ogg_url] && s3_manager.exists?(filename(type=default_type))
|
||||
s3_manager.delete(filename(type='mp3')) if self[:mp3_url] && s3_manager.exists?(filename(type=default_type))
|
||||
s3_manager.delete(filename(type='mp3')) if self[:mp3_url] && s3_manager.exists?(filename(type='mp3'))
|
||||
end
|
||||
|
||||
def self.construct_filename(created_at, recording_id, id, type='ogg')
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ module JamRuby
|
|||
recording.music_session = music_session
|
||||
recording.owner = owner
|
||||
recording.band = music_session.band
|
||||
recording.video = record_video
|
||||
recording.video = record_video == true || record_video == 'true'
|
||||
|
||||
if recording.save
|
||||
#GoogleAnalyticsEvent.report_band_recording(recording.band)
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
# if we make it this far, all is well!
|
||||
jam_track_right = JamRuby::JamTrackRight.find_or_create_by_user_id_and_jam_track_id(current_user.id, jam_track.id) do |jam_track_right|
|
||||
jam_track_right = JamRuby::JamTrackRight.find_or_create_by({user_id: current_user.id, jam_track_id: jam_track.id}) do |jam_track_right|
|
||||
jam_track_right.redeemed = using_free_credit
|
||||
jam_track_right.version = jam_track.version
|
||||
end
|
||||
|
|
@ -168,10 +168,10 @@ module JamRuby
|
|||
sales = []
|
||||
|
||||
|
||||
if Sale.is_mixed(shopping_carts)
|
||||
# the controller checks this too; this is just an extra-level of sanity checking
|
||||
return sales
|
||||
end
|
||||
#if Sale.is_mixed(shopping_carts)
|
||||
# # the controller checks this too; this is just an extra-level of sanity checking
|
||||
# return sales
|
||||
#end
|
||||
|
||||
jam_track_sale = order_jam_tracks(current_user, shopping_carts)
|
||||
sales << jam_track_sale if jam_track_sale
|
||||
|
|
@ -236,7 +236,7 @@ module JamRuby
|
|||
|
||||
price_info = charge_stripe_for_lesson(charge, current_user, lesson_booking, lesson_package_type, sale_line_item, lesson_session, lesson_package_purchase, force)
|
||||
|
||||
post_stripe_test_failure
|
||||
post_sale_test_failure
|
||||
|
||||
if price_info[:purchase] && price_info[:purchase].errors.any?
|
||||
purchase = price_info[:purchase]
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ module JamRuby
|
|||
validates :cart_type, presence: true
|
||||
validates :cart_class_name, presence: true
|
||||
validates :marked_for_redeem, numericality: {only_integer: true}
|
||||
validate :not_mixed
|
||||
#validate :not_mixed
|
||||
|
||||
default_scope { order('created_at DESC') }
|
||||
|
||||
def product_info(instance = nil)
|
||||
product = self.cart_product
|
||||
data = {type: cart_type, name: product.name, price: product.price, product_id: cart_id, plan_code: product.plan_code, real_price: real_price(product), total_price: total_price(product), quantity: quantity, marked_for_redeem: marked_for_redeem, free: free?, sales_region: product.sales_region, sale_display:product.sale_display} unless product.nil?
|
||||
data = {type: cart_type, name: product.name, price: product.price, product_id: cart_id, plan_code: product.plan_code, real_price: real_price(product), total_price: total_price(product), quantity: quantity, marked_for_redeem: marked_for_redeem, free: free?, sales_region: product.sales_region, sale_display:product.sale_display, allow_free: allow_free(product)} unless product.nil?
|
||||
if data && instance
|
||||
data.merge!(instance.product_info)
|
||||
end
|
||||
|
|
@ -45,6 +45,14 @@ module JamRuby
|
|||
(quantity - marked_for_redeem) * product.price
|
||||
end
|
||||
|
||||
def allow_free(product)
|
||||
if(product.is_a?(JamTrack))
|
||||
product.allow_free
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def not_mixed
|
||||
|
||||
return if @skip_mix_check
|
||||
|
|
@ -131,22 +139,7 @@ module JamRuby
|
|||
|
||||
if free?
|
||||
# create the credit, then the pseudo charge
|
||||
[
|
||||
{
|
||||
accounting_code: PURCHASE_FREE_CREDIT,
|
||||
currency: 'USD',
|
||||
unit_amount_in_cents: -(info[:total_price] * 100).to_i,
|
||||
description: info[:sale_display] + " (Credit)",
|
||||
tax_exempt: true
|
||||
},
|
||||
{
|
||||
accounting_code: PURCHASE_FREE,
|
||||
currency: 'USD',
|
||||
unit_amount_in_cents: (info[:total_price] * 100).to_i,
|
||||
description: info[:sale_display],
|
||||
tax_exempt: true
|
||||
}
|
||||
]
|
||||
[]
|
||||
else
|
||||
|
||||
[
|
||||
|
|
@ -193,6 +186,7 @@ module JamRuby
|
|||
if any_user.has_redeemable_jamtrack || any_user.gifted_jamtracks > 0
|
||||
|
||||
free_in_cart = 0
|
||||
|
||||
any_user.shopping_carts.each do |shopping_cart|
|
||||
# but if we find any shopping cart item already marked for redeem, then back out of mark_redeem=true
|
||||
if shopping_cart.cart_type == JamTrack::PRODUCT_TYPE
|
||||
|
|
@ -211,15 +205,17 @@ module JamRuby
|
|||
cart = nil
|
||||
ShoppingCart.transaction do
|
||||
|
||||
if clear
|
||||
# if clear
|
||||
if any_user.shopping_carts.length == 1 && any_user.shopping_carts[0].product_info[:allow_free] && (any_user.has_redeemable_jamtrack && any_user.gifted_jamtracks == 0) && jam_track.allow_free && any_user.free_jamtracks > 0 # clear
|
||||
# if you are an anonymous user, we make sure there is nothing else in your shopping cart ... keep it clean for the 'new user rummaging around for a freebie scenario'
|
||||
any_user.destroy_jam_track_shopping_carts
|
||||
any_user.reload
|
||||
end
|
||||
|
||||
mark_redeem = ShoppingCart.user_has_redeemable_jam_track?(any_user)
|
||||
mark_redeem = jam_track.allow_free ? ShoppingCart.user_has_redeemable_jam_track?(any_user) : false
|
||||
cart = ShoppingCart.create(any_user, jam_track, 1, mark_redeem)
|
||||
end
|
||||
any_user.reload
|
||||
cart
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@ module JamRuby
|
|||
has_many :languages, :class_name => "JamRuby::Language", :through => :teachers_languages # , :order => "description"
|
||||
has_many :teachers_languages, class_name: "JamRuby::TeacherLanguage"
|
||||
has_many :teacher_experiences, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_teaching, -> {where(experience_type: 'teaching')}, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_education, -> {where(experience_type: 'education')}, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_award, -> {where(experience_type: 'award')}, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_teaching, -> { where(experience_type: 'teaching') }, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_education, -> { where(experience_type: 'education') }, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :experiences_award, -> { where(experience_type: 'award') }, :class_name => "JamRuby::TeacherExperience"
|
||||
has_many :reviews, :class_name => "JamRuby::Review", as: :target
|
||||
has_many :lesson_sessions, :class_name => "JamRuby::LessonSession"
|
||||
has_many :lesson_package_purchases, :class_name => "JamRuby::LessonPackagePurchase"
|
||||
has_one :review_summary, :class_name => "JamRuby::ReviewSummary", as: :target
|
||||
has_one :user, :class_name => 'JamRuby::User', foreign_key: :teacher_id
|
||||
has_one :review_summary, :class_name => "JamRuby::ReviewSummary", as: :target
|
||||
has_one :user, :class_name => 'JamRuby::User', foreign_key: :teacher_id
|
||||
belongs_to :school, :class_name => "JamRuby::School", inverse_of: :teachers
|
||||
|
||||
validates :user, :presence => true
|
||||
validates :biography, length: {minimum: 5, maximum: 4096}, :if => :validate_introduction
|
||||
validates :introductory_video, :format => {:with => /A(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?([\w-]{10,})z/, message: "is not a valid youtube URL"}, :allow_blank => true, :if => :validate_introduction
|
||||
validates :introductory_video, :format => {:with => /(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?([\w-]{10,})/, message: "is not a valid youtube URL"}, :allow_blank => true, :if => :validate_introduction
|
||||
validates :years_teaching, :presence => true, :if => :validate_introduction
|
||||
validates :years_playing, :presence => true, :if => :validate_introduction
|
||||
validates :teaches_test_drive, inclusion: {in: [true, false]}, :if => :validate_pricing
|
||||
|
|
@ -159,13 +159,21 @@ module JamRuby
|
|||
end
|
||||
|
||||
def self.save_teacher(user, params)
|
||||
teacher = build_teacher(user, params)
|
||||
if teacher.save
|
||||
# flag the user as a teacher
|
||||
teacher.user.is_a_teacher = true
|
||||
teacher.user.save(validate: false)
|
||||
teacher = nil
|
||||
Teacher.transaction do
|
||||
teacher = build_teacher(user, params)
|
||||
if teacher.save
|
||||
# flag the user as a teacher
|
||||
teacher.user.is_a_teacher = true
|
||||
teacher.user.save(validate: false)
|
||||
end
|
||||
|
||||
if teacher.errors.any?
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
teacher
|
||||
|
||||
end
|
||||
|
||||
def self.build_teacher(user, params)
|
||||
|
|
@ -212,60 +220,79 @@ module JamRuby
|
|||
teacher.test_drives_per_week = 10 if !params.key?(:test_drives_per_week) # default to 10 in absence of others
|
||||
teacher.school_id = params[:school_id] if params.key?(:school_id)
|
||||
|
||||
|
||||
# Many-to-many relations:
|
||||
if params.key?(:genres)
|
||||
genres = params[:genres]
|
||||
genres = [] if genres.nil?
|
||||
teacher.genres = genres.collect { |genre_id| Genre.find(genre_id) }
|
||||
end
|
||||
if params.key?(:instruments)
|
||||
instruments = params[:instruments]
|
||||
instruments = [] if instruments.nil?
|
||||
teacher.instruments = instruments.collect { |instrument_id| Instrument.find(instrument_id) }
|
||||
end
|
||||
if params.key?(:subjects)
|
||||
subjects = params[:subjects]
|
||||
subjects = [] if subjects.nil?
|
||||
teacher.subjects = subjects.collect { |subject_id| Subject.find(subject_id) }
|
||||
end
|
||||
if params.key?(:languages)
|
||||
languages = params[:languages]
|
||||
languages = [] if languages.nil?
|
||||
teacher.languages = languages.collect { |language_id| Language.find(language_id) }
|
||||
end
|
||||
|
||||
# Experience:
|
||||
[:teaching, :education, :award].each do |experience_type|
|
||||
key = "experiences_#{experience_type}".to_sym
|
||||
if params.key?(key)
|
||||
list = params[key]
|
||||
list = [] if list.nil?
|
||||
experiences = list.collect do |exp|
|
||||
TeacherExperience.new(
|
||||
name: exp[:name],
|
||||
experience_type: experience_type,
|
||||
organization: exp[:organization],
|
||||
start_year: exp[:start_year],
|
||||
end_year: exp[:end_year]
|
||||
)
|
||||
end # collect
|
||||
|
||||
# we blindly destroy/recreate on every resubmit
|
||||
previous = teacher.send("#{key.to_s}")
|
||||
previous.destroy_all
|
||||
|
||||
# Dynamically call the appropriate method (just setting the
|
||||
# value doesn't result in the behavior we need)
|
||||
teacher.send("#{key.to_s}=", experiences)
|
||||
end # if
|
||||
end # do
|
||||
|
||||
# How to validate:
|
||||
teacher.validate_introduction = !!params[:validate_introduction]
|
||||
teacher.validate_basics = !!params[:validate_basics]
|
||||
teacher.validate_pricing = !!params[:validate_pricing]
|
||||
|
||||
|
||||
initial_save = teacher.save
|
||||
|
||||
teacher.validate_basics = !!params[:validate_basics]
|
||||
|
||||
if initial_save
|
||||
# Many-to-many relations:
|
||||
if params.key?(:genres)
|
||||
genres = params[:genres]
|
||||
genres = [] if genres.nil?
|
||||
teacher.genres.clear
|
||||
genres.each do |genre_id|
|
||||
teacher.genres << Genre.find(genre_id)
|
||||
end
|
||||
end
|
||||
if params.key?(:instruments)
|
||||
instruments = params[:instruments]
|
||||
instruments = [] if instruments.nil?
|
||||
teacher.instruments.clear
|
||||
instruments.each do |instrument_id|
|
||||
teacher.instruments << Instrument.find(instrument_id)
|
||||
end
|
||||
end
|
||||
if params.key?(:subjects)
|
||||
subjects = params[:subjects]
|
||||
subjects = [] if subjects.nil?
|
||||
teacher.subjects.clear
|
||||
subjects.each do |subject_id|
|
||||
teacher.subjects << Subject.find(subject_id)
|
||||
end
|
||||
end
|
||||
if params.key?(:languages)
|
||||
languages = params[:languages]
|
||||
languages = [] if languages.nil?
|
||||
teacher.languages.clear
|
||||
languages.each do |language_id|
|
||||
teacher.languages << Language.find(language_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Experience:
|
||||
[:teaching, :education, :award].each do |experience_type|
|
||||
key = "experiences_#{experience_type}".to_sym
|
||||
if params.key?(key)
|
||||
list = params[key]
|
||||
list = [] if list.nil?
|
||||
experiences = list.collect do |exp|
|
||||
TeacherExperience.new(
|
||||
name: exp[:name],
|
||||
experience_type: experience_type,
|
||||
organization: exp[:organization],
|
||||
start_year: exp[:start_year],
|
||||
end_year: exp[:end_year]
|
||||
)
|
||||
end # collect
|
||||
|
||||
# we blindly destroy/recreate on every resubmit
|
||||
previous = teacher.send("#{key.to_s}")
|
||||
previous.destroy_all
|
||||
|
||||
# Dynamically call the appropriate method (just setting the
|
||||
# value doesn't result in the behavior we need)
|
||||
teacher.send("#{key.to_s}=", experiences)
|
||||
end # if
|
||||
end # do
|
||||
end
|
||||
|
||||
|
||||
return teacher
|
||||
end
|
||||
|
||||
|
|
@ -325,6 +352,7 @@ module JamRuby
|
|||
self.top_rated = false
|
||||
self.save!
|
||||
end
|
||||
|
||||
def has_experiences_teaching?
|
||||
experiences_teaching.count > 0
|
||||
end
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ module JamRuby
|
|||
has_many :test_drive_package_choices, :class_name =>"JamRuby::TestDrivePackageChoice"
|
||||
has_many :jamblasters_users, class_name: "JamRuby::JamblasterUser"
|
||||
has_many :jamblasters, class_name: 'JamRuby::Jamblaster', through: :jamblasters_users
|
||||
has_many :proposed_slots, class_name: 'JamRuby::LessonBookingSlot', inverse_of: :proposer, dependent: :destroy, foreign_key: :proposer_id
|
||||
has_many :charges, class_name: 'JamRuby::Charge', dependent: :destroy
|
||||
|
||||
before_save :default_anonymous_names
|
||||
before_save :create_remember_token, :if => :should_validate_password?
|
||||
|
|
@ -1855,6 +1857,10 @@ module JamRuby
|
|||
ShoppingCart.where("user_id=?", self).destroy_all
|
||||
end
|
||||
|
||||
def mixed_cart
|
||||
Sale.is_mixed(shopping_carts)
|
||||
end
|
||||
|
||||
def destroy_jam_track_shopping_carts
|
||||
ShoppingCart.destroy_all(anonymous_user_id: @id, cart_type: JamTrack::PRODUCT_TYPE)
|
||||
end
|
||||
|
|
@ -2222,7 +2228,7 @@ module JamRuby
|
|||
end
|
||||
|
||||
def recent_test_drive_teachers
|
||||
User.select('distinct on (users.id) users.*').joins(taught_lessons: :music_session).where('lesson_sessions.lesson_type = ?', LessonSession::LESSON_TYPE_TEST_DRIVE).where('music_sessions.user_id = ?', id).where('lesson_sessions.created_at > ?', Rails.application.config.test_drive_wait_period_year.years.ago)
|
||||
User.select('distinct on (users.id) users.*').joins(taught_lessons: :music_session).where('lesson_sessions.lesson_type = ?', LessonSession::LESSON_TYPE_TEST_DRIVE).where('music_sessions.user_id = ?', id).where('lesson_sessions.created_at > ?', APP_CONFIG.test_drive_wait_period_year.years.ago)
|
||||
end
|
||||
|
||||
def mark_session_ready
|
||||
|
|
|
|||
|
|
@ -169,23 +169,26 @@ describe "Monthly Recurring Lesson Flow" do
|
|||
# let user pay for it
|
||||
LessonBooking.hourly_check
|
||||
|
||||
booked_price = booking.booked_price
|
||||
prorated = booked_price / 2
|
||||
prorated_cents = (booked_price * 100).to_i
|
||||
user.reload
|
||||
user.lesson_purchases.length.should eql 1
|
||||
lesson_purchase = user.lesson_purchases[0]
|
||||
puts "LESSON_PURCHASE PRICE #{lesson_purchase.price}"
|
||||
lesson_purchase.price.should eql 30.00
|
||||
lesson_purchase.price.should eql prorated
|
||||
lesson_purchase.lesson_package_type.is_normal?.should eql true
|
||||
lesson_purchase.price_in_cents.should eql 3000
|
||||
lesson_purchase.price_in_cents.should eql prorated_cents
|
||||
teacher_distribution = lesson_purchase.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 3000
|
||||
teacher_distribution.amount_in_cents.should eql prorated_cents
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.distributed.should be_false
|
||||
user.sales.length.should eql 1
|
||||
sale = user.sales.first
|
||||
sale.stripe_charge_id.should_not be_nil
|
||||
sale.recurly_tax_in_cents.should eql (100 * booking.booked_price.to_f * 0.0825).round.to_i
|
||||
sale.recurly_total_in_cents.should eql ((100 * booking.booked_price.to_f * 0.0825).round + 100 * booking.booked_price.to_f).to_i
|
||||
sale.recurly_subtotal_in_cents.should eql (100 * booking.booked_price).to_i
|
||||
sale.recurly_tax_in_cents.should eql (100 * prorated * 0.0825).round.to_i
|
||||
sale.recurly_total_in_cents.should eql ((prorated * 100 * 0.0825).round + 100 * prorated).to_i
|
||||
sale.recurly_subtotal_in_cents.should eql prorated_cents
|
||||
sale.recurly_currency.should eql 'USD'
|
||||
sale.stripe_charge_id.should_not be_nil
|
||||
line_item = sale.sale_line_items[0]
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ describe JamTrackImporter do
|
|||
end
|
||||
|
||||
describe "synchronize" do
|
||||
let(:jam_track) { JamTrack.new }
|
||||
let(:jam_track) { jt = JamTrack.new; jt.id = '1'; jt }
|
||||
let(:importer) { JamTrackImporter.new() }
|
||||
let(:minimum_meta) { nil }
|
||||
let(:metalocation) { 'audio/Artist 1/Song 1/meta.yml' }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ describe ActiveMusicSession do
|
|||
|
||||
invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session)
|
||||
|
||||
invitation.save
|
||||
invitation.save.should be_false
|
||||
invitation.errors.size.should == 1
|
||||
invitation.errors.get(:receiver).should == [Invitation::FRIENDSHIP_REQUIRED_VALIDATION_ERROR]
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ describe TeacherPaymentCharge, no_transaction: true do
|
|||
it "fails after stripe communication (in transaction)" do
|
||||
LessonPaymentCharge.transaction do
|
||||
|
||||
Sale.stub(:post_stripe_test_failure).and_raise('bad logic after stripe call')
|
||||
Sale.stub(:post_sale_test_failure).and_raise('bad logic after stripe call')
|
||||
|
||||
lesson.analyse
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ describe TeacherPaymentCharge, no_transaction: true do
|
|||
|
||||
it "fails after stripe communication (no transaction)" do
|
||||
|
||||
Sale.stub(:post_stripe_test_failure).and_raise('bad logic after stripe call')
|
||||
Sale.stub(:post_sale_test_failure).and_raise('bad logic after stripe call')
|
||||
|
||||
lesson.analyse
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ describe LessonSession do
|
|||
lesson_session1 = normal_lesson(user, teacher, {})
|
||||
|
||||
mailer = mock
|
||||
mailer.should_receive(:deliver!)
|
||||
mailer.should_receive(:deliver_now)
|
||||
UserMailer.should_receive(:teacher_counter_reminder).and_return(mailer)
|
||||
|
||||
LessonSession.remind_counters
|
||||
|
|
@ -161,7 +161,7 @@ describe LessonSession do
|
|||
lesson_session1 = normal_lesson(user, teacher, {counter: true, counterer: user})
|
||||
|
||||
mailer = mock
|
||||
mailer.should_receive(:deliver!)
|
||||
mailer.should_receive(:deliver_now)
|
||||
UserMailer.should_receive(:teacher_counter_reminder).and_return(mailer)
|
||||
|
||||
LessonSession.remind_counters
|
||||
|
|
@ -179,7 +179,7 @@ describe LessonSession do
|
|||
lesson_session1 = normal_lesson(user, teacher, {counter: true, counterer: teacher})
|
||||
|
||||
mailer = mock
|
||||
mailer.should_receive(:deliver!)
|
||||
mailer.should_receive(:deliver_now)
|
||||
UserMailer.should_receive(:student_counter_reminder).and_return(mailer)
|
||||
|
||||
LessonSession.remind_counters
|
||||
|
|
@ -215,11 +215,10 @@ describe LessonSession do
|
|||
Timecop.travel(Date.today + 100)
|
||||
lesson.accept({
|
||||
message: "Teacher time!",
|
||||
acceptor: teacher,
|
||||
accepter: teacher,
|
||||
slot: slotRecurring1.id
|
||||
})
|
||||
lesson.errors.any?.should be_true
|
||||
lesson.errors[:slot].should eql ["is in the past"]
|
||||
lesson.errors.any?.should be_false
|
||||
end
|
||||
|
||||
it "cancel in the past is OK" do
|
||||
|
|
|
|||
|
|
@ -229,6 +229,50 @@ describe Sale do
|
|||
user.has_redeemable_jamtrack.should be_false
|
||||
end
|
||||
|
||||
it "for two jamtracks 1 freebie, 1 purchased" do
|
||||
user.gifted_jamtracks = 2
|
||||
user.save!
|
||||
|
||||
jamtrack.allow_free = false
|
||||
jamtrack.price =2.99
|
||||
jamtrack.save!
|
||||
|
||||
shopping_cart1 = ShoppingCart.create user, jamtrack, 1, false
|
||||
shopping_cart2 = ShoppingCart.create user, jamtrack2, 1, true
|
||||
|
||||
client.find_or_create_account(user, billing_info)
|
||||
|
||||
sales = Sale.place_order(user, [shopping_cart1, shopping_cart2])
|
||||
|
||||
user.reload
|
||||
user.sales.length.should eq(1)
|
||||
sale = sales[0]
|
||||
sale.reload
|
||||
|
||||
sale.recurly_invoice_id.should_not be_nil
|
||||
|
||||
sale.recurly_subtotal_in_cents.should eq(jamtrack.price * 100)
|
||||
sale.recurly_tax_in_cents.should eq(0)
|
||||
sale.recurly_total_in_cents.should eq(jamtrack.price * 100)
|
||||
sale.recurly_currency.should eq('USD')
|
||||
sale.order_total.should eq(jamtrack.price)
|
||||
sale.sale_line_items.length.should == 2
|
||||
|
||||
sale.sale_line_items[0].free.should eql 0
|
||||
assert_free_line_item(sale.sale_line_items[1], jamtrack2)
|
||||
|
||||
# verify jam_track_rights data
|
||||
right1 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack.id).first
|
||||
right2 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack2.id).first
|
||||
user.jam_track_rights.should have(2).items
|
||||
|
||||
right1.redeemed.should be_false
|
||||
right2.redeemed.should be_true
|
||||
user.has_redeemable_jamtrack.should be_false
|
||||
user.gifted_jamtracks.should eq(2)
|
||||
|
||||
end
|
||||
|
||||
it "for two jam tracks (1 freebie, 1 gifted), then 1 gifted/1 pay" do
|
||||
user.gifted_jamtracks = 2
|
||||
user.save!
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ describe ShoppingCart do
|
|||
user.shopping_carts[0].quantity.should == 1
|
||||
end
|
||||
|
||||
it "maintains only one free JamTrack in ShoppingCart" do
|
||||
it "allows mix of free and not free stuff" do
|
||||
cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track, clear: true)
|
||||
cart1.should_not be_nil
|
||||
cart1.errors.any?.should be_false
|
||||
|
|
@ -41,13 +41,13 @@ describe ShoppingCart do
|
|||
user.reload
|
||||
user.shopping_carts.length.should eq(1)
|
||||
cart3 = ShoppingCart.add_item_to_cart(user, gift_card)
|
||||
cart3.errors.any?.should be_true
|
||||
cart3.errors.any?.should be_false
|
||||
user.reload
|
||||
user.shopping_carts.length.should eq(1)
|
||||
user.shopping_carts.length.should eq(2)
|
||||
cart4 = ShoppingCart.add_jam_track_to_cart(user, jam_track2, clear: true)
|
||||
cart4.errors.any?.should be_false
|
||||
user.reload
|
||||
user.shopping_carts.length.should eq(1)
|
||||
user.shopping_carts.length.should eq(3)
|
||||
end
|
||||
|
||||
it "should not add duplicate JamTrack to ShoppingCart" do
|
||||
|
|
@ -150,9 +150,9 @@ describe ShoppingCart do
|
|||
cart6.marked_for_redeem.should eq(1)
|
||||
|
||||
cart7 = ShoppingCart.add_jam_track_to_cart(user, jam_track7)
|
||||
cart7.errors.any?.should be_true
|
||||
cart7.errors.any?.should be_false
|
||||
user.reload
|
||||
user.shopping_carts.length.should eq(6)
|
||||
user.shopping_carts.length.should eq(7)
|
||||
cart1.marked_for_redeem.should eq(1)
|
||||
cart2.marked_for_redeem.should eq(1)
|
||||
cart3.marked_for_redeem.should eq(1)
|
||||
|
|
@ -183,26 +183,30 @@ describe ShoppingCart do
|
|||
|
||||
describe "mixed" do
|
||||
it "non-free then free" do
|
||||
jam_track.allow_free = false
|
||||
jam_track.save!
|
||||
|
||||
# you shouldn't be able to add a free after a non-free
|
||||
user.has_redeemable_jamtrack = false
|
||||
user.has_redeemable_jamtrack = true
|
||||
user.save!
|
||||
|
||||
cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track)
|
||||
cart1.should_not be_nil
|
||||
cart1.errors.any?.should be_false
|
||||
|
||||
user.has_redeemable_jamtrack = true
|
||||
user.save!
|
||||
user.reload
|
||||
cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2)
|
||||
cart2.errors.any?.should be_true
|
||||
cart2.errors[:base].should eq(["You can not add a free JamTrack to a cart with non-free items. Please clear out your cart."])
|
||||
cart2.errors.any?.should be_false
|
||||
#cart2.errors[:base].should eq(["You can not add a free JamTrack to a cart with non-free items. Please clear out your cart."])
|
||||
|
||||
user.shopping_carts.length.should eq(1)
|
||||
user.reload
|
||||
user.shopping_carts.length.should eq(2)
|
||||
end
|
||||
|
||||
it "free then non-free" do
|
||||
|
||||
jam_track2.allow_free = false
|
||||
jam_track2.save!
|
||||
cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track)
|
||||
cart1.should_not be_nil
|
||||
cart1.errors.any?.should be_false
|
||||
|
|
@ -210,10 +214,11 @@ describe ShoppingCart do
|
|||
user.reload
|
||||
|
||||
cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2)
|
||||
cart2.errors.any?.should be_true
|
||||
cart2.errors[:base].should eq(["You can not add a non-free JamTrack to a cart containing free items. Please clear out your cart."])
|
||||
cart2.errors.any?.should be_false
|
||||
#cart2.errors[:base].should eq(["You can not add a non-free JamTrack to a cart containing free items. Please clear out your cart."])
|
||||
|
||||
user.shopping_carts.length.should eq(1)
|
||||
user.reload
|
||||
user.shopping_carts.length.should eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ describe Teacher do
|
|||
|
||||
#teacher.instruments << Instrument.find('electric guitar')
|
||||
#teacher.save!
|
||||
puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
teachers = Teacher.index(nil, {instruments: ['acoustic guitar']})[:query]
|
||||
puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!---"
|
||||
teachers.length.should eq 1
|
||||
teachers[0].should eq(teacher.user)
|
||||
end
|
||||
|
|
@ -416,7 +414,6 @@ describe Teacher do
|
|||
validate_introduction: true
|
||||
)
|
||||
|
||||
puts "teacher.errors #{teacher.errors.inspect}"
|
||||
teacher.should_not be_nil
|
||||
teacher.id.should_not be_nil
|
||||
teacher.errors.should be_empty
|
||||
|
|
@ -426,10 +423,10 @@ describe Teacher do
|
|||
it "basics" do
|
||||
teacher = Teacher.save_teacher(
|
||||
user,
|
||||
# instruments: [instrument1, instrument2],
|
||||
# subjects: [subject1, subject2],
|
||||
# genres: [genre1, genre2],
|
||||
# languages: [language1, language2],
|
||||
# instruments: [instrument1, instrument2],
|
||||
# subjects: [subject1, subject2],
|
||||
# genres: [genre1, genre2],
|
||||
# languages: [language1, language2],
|
||||
teaches_age_lower: 10,
|
||||
teaches_beginner: true,
|
||||
teaches_intermediate: false,
|
||||
|
|
@ -438,11 +435,11 @@ describe Teacher do
|
|||
)
|
||||
|
||||
teacher.should_not be_nil
|
||||
teacher.id.should be_nil
|
||||
teacher.errors.should have_key(:instruments)
|
||||
teacher.errors.should have_key(:subjects)
|
||||
teacher.errors.should have_key(:genres)
|
||||
teacher.errors.should have_key(:languages)
|
||||
Teacher.find_by_id(teacher.id).should be_nil
|
||||
end
|
||||
|
||||
it "pricing" do
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe BatchMailer do
|
||||
|
||||
describe "should send test emails" do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
batch = FactoryGirl.create(:email_batch)
|
||||
batch.send_test_batch
|
||||
|
||||
mail = BatchMailer.deliveries.detect { |dd| dd['to'].to_s.split(',')[0] == batch.test_emails.split(',')[0]}
|
||||
# let (:mail) { BatchMailer.deliveries[0] }
|
||||
# it { mail['to'].to_s.split(',')[0].should == batch.test_emails.split(',')[0] }
|
||||
|
||||
it { mail.should_not be_nil }
|
||||
|
||||
# it { BatchMailer.deliveries.length.should == 1 }
|
||||
|
||||
it { mail['from'].to_s.should == "JamKazam <noreply@jamkazam.com>" }
|
||||
it { mail.subject.should == batch.subject }
|
||||
|
||||
it { mail.multipart?.should == true } # because we send plain + html
|
||||
it { mail.text_part.decode_body.should match(/#{Regexp.escape(batch.body)}/) }
|
||||
|
||||
it { batch.testing?.should == true }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -135,6 +135,11 @@ describe UserMailer do
|
|||
# verify that the messages are correctly configured
|
||||
it { mail.html_part.body.include?("to confirm your change in email").should be_true }
|
||||
it { mail.text_part.body.include?("to confirm your change in email").should be_true }
|
||||
|
||||
# verify can unsubscribe from bulk emails
|
||||
|
||||
it {mail.html_part.body.include?('here to unsubscribe').should be_true}
|
||||
it {mail.html_part.body.include?("https://www.jamkazam.com/unsubscribe/#{user.unsubscribe_token}")}
|
||||
end
|
||||
|
||||
describe "notifications" do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
context = window
|
||||
rest = context.JK.Rest()
|
||||
logger = context.JK.logger
|
||||
|
||||
SessionActions = context.SessionActions
|
||||
UserStore = context.UserStore
|
||||
LessonTimerStore = context.LessonTimerStore
|
||||
LessonTimerActions = context.LessonTimerActions
|
||||
|
||||
@Conditional = React.createClass({
|
||||
|
||||
render: () ->
|
||||
if this.props.test
|
||||
return this.props.children
|
||||
else
|
||||
return false
|
||||
})
|
||||
|
|
@ -46,9 +46,9 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
if track.part != ''
|
||||
track.instrument_desc += ' (' + track.part + ')'
|
||||
|
||||
trackRow.free_state = if @state.is_free then 'free' else 'non-free'
|
||||
trackRow.free_state = if (@state.is_free && jamtrack.allow_free) then 'free' else 'non-free'
|
||||
|
||||
trackRow.is_free = @state.is_free
|
||||
trackRow.is_free = @state.is_free && jamtrack.allow_free
|
||||
|
||||
uiJamTracks.push trackRow
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
if jamtrack.purchased
|
||||
actionBtn = `<a className="jamtrack-add-cart-disabled button-grey button-disabled" href="javascript:void(0)">PURCHASED</a>`
|
||||
else if jamtrack.is_free
|
||||
actionBtn = `<a className="jamtrack-add-cart button-orange is_free" href="#" data-jamtrack-id={jamtrack.id}> GET IT FREE!</a>`
|
||||
actionBtn = `<a className="jamtrack-add-cart button-orange is_free" href="#" data-jamtrack-id={jamtrack.id}>GET IT FREE!</a>`
|
||||
else if jamtrack.added_cart
|
||||
actionBtn = `<a className="jamtrack-add-cart-disabled button-grey button-disabled" href="client#/shoppingCart">ALREADY IN CART</a>`
|
||||
else
|
||||
|
|
@ -303,21 +303,13 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
isFree = $(e.target).is('.is_free')
|
||||
|
||||
@rest.addJamtrackToShoppingCart(params).done((response) =>
|
||||
if context.JK.currentUserId?
|
||||
if isFree
|
||||
if @user.has_redeemable_jamtrack
|
||||
# this is the 1st jamtrack; let's user the user to completion
|
||||
context.location = '/client#/redeemComplete'
|
||||
else
|
||||
# this is must be a user's gifted jamtrack, to treat them normally in that they'll go to the shopping cart
|
||||
#context.location = '/client#/shoppingCart'
|
||||
context.location = '/client#/redeemComplete'
|
||||
if response.fast_reedem
|
||||
if context.JK.currentUserId?
|
||||
context.location = '/client#/redeemComplete'
|
||||
else
|
||||
# this user has nothing free; so send them to shopping cart
|
||||
context.location = '/client#/shoppingCart'
|
||||
context.location = '/client#/redeemSignup'
|
||||
else
|
||||
# user not logged in; make them signup
|
||||
context.location = '/client#/redeemSignup'
|
||||
context.location = '/client#/shoppingCart'
|
||||
|
||||
).fail(() => @app.ajaxError)
|
||||
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
if track.part != ''
|
||||
track.instrument_desc += ' (' + track.part + ')'
|
||||
|
||||
trackRow.free_state = if @state.is_free then 'free' else 'non-free'
|
||||
trackRow.free_state = if (@state.is_free && jamtrack.allow_free) then 'free' else 'non-free'
|
||||
|
||||
trackRow.is_free = @state.is_free
|
||||
trackRow.is_free = @state.is_free && jamtrack.allow_free
|
||||
|
||||
uiJamTracks.push trackRow
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
if jamtrack.purchased
|
||||
actionBtn = `<a className="jamtrack-add-cart-disabled button-grey button-disabled" href="javascript:void(0)">PURCHASED</a>`
|
||||
else if jamtrack.is_free
|
||||
actionBtn = `<a className="jamtrack-add-cart button-orange is_free" href="#" data-jamtrack-id={jamtrack.id}> GET IT FREE!</a>`
|
||||
actionBtn = `<a className="jamtrack-add-cart button-orange is_free" href="#" data-jamtrack-id={jamtrack.id}>GET IT FREE!</a>`
|
||||
else if jamtrack.added_cart
|
||||
actionBtn = `<a className="jamtrack-add-cart-disabled button-grey button-disabled" href="client#/shoppingCart">ALREADY IN CART</a>`
|
||||
else
|
||||
|
|
@ -443,25 +443,14 @@ MIX_MODES = context.JK.MIX_MODES
|
|||
isFree = $(e.target).is('.is_free')
|
||||
|
||||
@rest.addJamtrackToShoppingCart(params).done((response) =>
|
||||
if context.JK.currentUserId?
|
||||
if isFree
|
||||
if @user.has_redeemable_jamtrack
|
||||
# this is the 1st jamtrack; let's user the user to completion
|
||||
context.location = '/client#/redeemComplete'
|
||||
else
|
||||
# this is must be a user's gifted jamtrack, to treat them normally in that they'll go to the shopping cart
|
||||
#context.location = '/client#/shoppingCart'
|
||||
context.location = '/client#/redeemComplete'
|
||||
console.log("added item to shopping cart. fast_redeem? " + response.fast_redeem)
|
||||
if response.fast_reedem
|
||||
if context.JK.currentUserId?
|
||||
context.location = '/client#/redeemComplete'
|
||||
else
|
||||
# this user has nothing free; so send them to shopping cart
|
||||
context.location = '/client#/shoppingCart'
|
||||
else
|
||||
if isFree
|
||||
# user not logged in; make them signup
|
||||
context.location = '/client#/redeemSignup'
|
||||
else
|
||||
# this user has nothing free; so send them to shopping cart
|
||||
context.location = '/client#/shoppingCart'
|
||||
else
|
||||
context.location = '/client#/shoppingCart'
|
||||
|
||||
|
||||
).fail(((jqxhr) =>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ JamTrackPlayerStore = reactContext.JamTrackPlayerStore
|
|||
e.preventDefault()
|
||||
|
||||
new window.Fingerprint2().get((result, components) => (
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{@state.mixdown.id}/download.mp3?file_type=mp3&sample_rate=#{@sampleRate}&download=1&mark=#{result}")
|
||||
redirectTo = "/api/mixdowns/#{@state.mixdown.id}/download.mp3?file_type=mp3&sample_rate=#{@sampleRate}&download=1&mark=#{result}"
|
||||
redirectTo = URI.escape(redirectTo)
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/signin?redirect-to=#{redirectTo}")
|
||||
))
|
||||
|
||||
enqueue: (e) ->
|
||||
|
|
|
|||
|
|
@ -500,7 +500,9 @@ mixins.push(Reflux.listenTo(UserStore, 'onUserChanged'))
|
|||
return if @verificationCheck()
|
||||
|
||||
new window.Fingerprint2().get((result, components) => (
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1&mark=#{result}")
|
||||
redirectTo = "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1&mark=#{result}"
|
||||
redirectTo = URI.escape(redirectTo)
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/signin?redirect-to=#{redirectTo}")
|
||||
))
|
||||
|
||||
stemChanged:() ->
|
||||
|
|
@ -519,7 +521,9 @@ mixins.push(Reflux.listenTo(UserStore, 'onUserChanged'))
|
|||
e.preventDefault()
|
||||
|
||||
new window.Fingerprint2().get((result, components) => (
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{@state.jamTrackState.jamTrack.id}/stems/#{selectedTrackId}/download.mp3?file_type=mp3&download=1&mark=#{result}")
|
||||
redirectTo = "/api/jamtracks/#{@state.jamTrackState.jamTrack.id}/stems/#{selectedTrackId}/download.mp3?file_type=mp3&download=1&mark=#{result}"
|
||||
redirectTo = URI.escape(redirectTo)
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/signin?redirect-to=#{redirectTo}")
|
||||
))
|
||||
|
||||
|
||||
|
|
@ -562,7 +566,9 @@ mixins.push(Reflux.listenTo(UserStore, 'onUserChanged'))
|
|||
|
||||
if browserPackage?.signing_state == 'SIGNED'
|
||||
new window.Fingerprint2().get((result, components) => (
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1&mark=#{result}")
|
||||
redirectTo = "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1&mark=#{result}"
|
||||
redirectTo = URI.escape(redirectTo)
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/signin?redirect-to=#{redirectTo}")
|
||||
))
|
||||
else
|
||||
JamTrackMixdownActions.openDownloader(mixdown)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ LocationActions = @LocationActions
|
|||
@iCheckify()
|
||||
|
||||
getInitialState: () ->
|
||||
{options: {onlyMySchool: true}}
|
||||
{onlyMySchool: true, options: {onlyMySchool: true}}
|
||||
|
||||
onAppInit: (@app) ->
|
||||
@app.bindScreen('jamclass/searchOptions', {beforeShow: @beforeShow, afterShow: @afterShow})
|
||||
|
|
@ -39,7 +39,8 @@ LocationActions = @LocationActions
|
|||
@setState(user: @user?.user)
|
||||
|
||||
onTeacherSearchChanged: (options) ->
|
||||
@setState({options: options})
|
||||
|
||||
@setState({onlyMySchool: options.onlyMySchool, options: options})
|
||||
|
||||
handleListChange: (listName, selectedObjects)->
|
||||
logger.debug("handleListChange:", listName, selectedObjects)
|
||||
|
|
@ -83,7 +84,7 @@ LocationActions = @LocationActions
|
|||
checked = $target.is(':checked')
|
||||
options = @state.options
|
||||
options.onlyMySchool = checked
|
||||
@setState(options)
|
||||
@setState({options: options, onlyMySchool: checked})
|
||||
|
||||
checkboxChanged: (e) ->
|
||||
$target = $(e.target)
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@ context = window
|
|||
|
||||
window.modernNavInit();
|
||||
|
||||
jamClassClicked: (e) ->
|
||||
e.preventDefault()
|
||||
alertify.alert("COMING SOON!");
|
||||
|
||||
render: () ->
|
||||
|
||||
items = []
|
||||
|
|
@ -118,7 +114,7 @@ context = window
|
|||
Revolutionizing the way musicians connect, play, learn and earn. Across a city or across a nation.
|
||||
<br/>
|
||||
<br/>
|
||||
<a className="button" href="/signup">JOIN TODAY, PLAY FREE!</a>
|
||||
<a className="button join-today" href="/signup">JOIN TODAY, PLAY FREE!</a>
|
||||
|
||||
<div className="text-center"><a href="/signin" className="sign-in">Already a member? Sign in.</a></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ context = window
|
|||
<p>
|
||||
<div className="video-wrapper left">
|
||||
<div className="video-container">
|
||||
<iframe src="//www.youtube.com/embed/ysptXwFYDhQ" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
<Conditional test={gon.env != 'test'}>
|
||||
<iframe src="//www.youtube.com/embed/ysptXwFYDhQ" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
</Conditional>
|
||||
</div>
|
||||
<div className="cta-text">watch this sample video made by one of our users</div>
|
||||
</div>
|
||||
|
|
@ -117,7 +119,9 @@ context = window
|
|||
<p>
|
||||
<div className="video-wrapper">
|
||||
<div className="video-container">
|
||||
<iframe src="//www.youtube.com/embed/MASQJnlUBAM" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
<Conditional test={gon.env != 'test'}>
|
||||
<iframe src="//www.youtube.com/embed/MASQJnlUBAM" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
</Conditional>
|
||||
</div>
|
||||
<div className="cta-text">watch this sample video made by three of our users</div>
|
||||
</div>
|
||||
|
|
@ -170,7 +174,9 @@ context = window
|
|||
<h3>Watch A JamTracks Overview Video</h3>
|
||||
<div className="video-wrapper">
|
||||
<div className="video-container">
|
||||
<iframe src="//www.youtube.com/embed/07zJC7C2ICA" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
<Conditional test={gon.env != 'test'}>
|
||||
<iframe src="//www.youtube.com/embed/07zJC7C2ICA" frameborder="0" allowfullscreen="allowfullscreen" />
|
||||
</Conditional>
|
||||
</div>
|
||||
</div>
|
||||
<br className="clearall"/>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ rest = context.JK.Rest()
|
|||
|
||||
@JamTrackLandingPage = React.createClass({
|
||||
|
||||
isFree: () ->
|
||||
context.JK.currentUserFreeJamTrack && @props.jam_track.allow_free
|
||||
render: () ->
|
||||
|
||||
hasFree = context.JK.currentUserFreeJamTrack
|
||||
|
||||
loggedIn = context.JK.currentUserId?
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ rest = context.JK.Rest()
|
|||
else if this.state.processing
|
||||
ctaButtonText = 'hold on...'
|
||||
else
|
||||
if hasFree
|
||||
if @isFree()
|
||||
ctaButtonText = 'GET IT FREE!'
|
||||
else
|
||||
ctaButtonText = 'Add To Cart'
|
||||
|
|
@ -33,11 +34,11 @@ rest = context.JK.Rest()
|
|||
else
|
||||
if loggedIn
|
||||
loggedInCtaButton = `<button className={classNames({'cta-button' : true, 'processing': this.state.processing})} onClick={this.ctaClick}>{ctaButtonText}</button>`
|
||||
if !hasFree
|
||||
loggedInPriceAdvisory = `<div className="price-advisory">$1.99</div>`
|
||||
if !@isFree()
|
||||
loggedInPriceAdvisory = `<div className="price-advisory">${this.props.jam_track.price}</div>`
|
||||
else
|
||||
if !hasFree
|
||||
loggedOutPriceAdvisory = `<div className="price-advisory">$1.99</div>`
|
||||
if !@isFree()
|
||||
loggedOutPriceAdvisory = `<div className="price-advisory">${this.props.jam_track.price}</div>`
|
||||
|
||||
if this.state.loginErrors?
|
||||
for key, value of this.state.loginErrors
|
||||
|
|
@ -135,7 +136,7 @@ rest = context.JK.Rest()
|
|||
|
||||
loggedIn = context.JK.currentUserId?
|
||||
|
||||
isFree = context.JK.currentUserFreeJamTrack
|
||||
isFree = @isFree()
|
||||
|
||||
|
||||
rest.addJamtrackToShoppingCart({id: @props.jam_track.id, clear:true}).done((response) =>
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@ body.jamtrack-player-popup.popup {
|
|||
}
|
||||
.stems {
|
||||
|
||||
|
||||
height:147px;
|
||||
overflow:auto;
|
||||
margin:20px 0;
|
||||
|
|
@ -165,6 +164,9 @@ body.jamtrack-player-popup.popup {
|
|||
width:100%;
|
||||
}
|
||||
|
||||
tr.stem {
|
||||
text-align:left;
|
||||
}
|
||||
th {
|
||||
color:white;
|
||||
font-size:14px;
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ class ApiRecurlyController < ApiController
|
|||
error=nil
|
||||
response = {jam_tracks: [], gift_cards: []}
|
||||
|
||||
if Sale.is_mixed(current_user.shopping_carts)
|
||||
msg = "has free and non-free items. Try removing non-free items."
|
||||
render json: {message: "Cart " + msg, errors: {cart: [msg]}}, :status => 404
|
||||
return
|
||||
end
|
||||
#if Sale.is_mixed(current_user.shopping_carts)
|
||||
# msg = "has free and non-free items. Try removing non-free items."
|
||||
# render json: {message: "Cart " + msg, errors: {cart: [msg]}}, :status => 404
|
||||
# return
|
||||
#end
|
||||
|
||||
sales = Sale.place_order(current_user, current_user.shopping_carts)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,13 @@ class ApiReviewsController < ApiController
|
|||
|
||||
# Create a review:
|
||||
def create
|
||||
target = User.find(params['target_id'])
|
||||
if params[:target_type] == 'JamRuby::Teacher'
|
||||
target = target.teacher
|
||||
if params[:target_type] == 'JamRuby::JamTrack'
|
||||
target = JamTrack.find(params['target_id'])
|
||||
else
|
||||
target = User.find(params['target_id'])
|
||||
if params[:target_type] == 'JamRuby::Teacher'
|
||||
target = target.teacher
|
||||
end
|
||||
end
|
||||
|
||||
params[:target] = target
|
||||
|
|
@ -25,7 +29,6 @@ class ApiReviewsController < ApiController
|
|||
|
||||
@review = Review.create_or_update(params)
|
||||
|
||||
puts "@review.errors #{@review.errors.inspect}"
|
||||
if @review.errors.any?
|
||||
respond_with_model(@review)
|
||||
return
|
||||
|
|
@ -34,7 +37,7 @@ class ApiReviewsController < ApiController
|
|||
|
||||
# List reviews matching targets for given review summary:
|
||||
def details
|
||||
reviews = Review.index(:target_id=>@review_summary.target_id)
|
||||
reviews = Review.index(:target_id => @review_summary.target_id)
|
||||
@reviews = reviews.paginate(page: params[:page], per_page: params[:per_page])
|
||||
respond_with @reviews, responder: ApiResponder, :status => 200
|
||||
end
|
||||
|
|
@ -58,7 +61,7 @@ class ApiReviewsController < ApiController
|
|||
render :json => {}, status: 204
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
|
||||
def lookup_review_summary
|
||||
@review_summary = ReviewSummary.find(params[:review_summary_id])
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ class LandingsController < ApplicationController
|
|||
gon.jam_track_plan_code = @jam_track.plan_code if @jam_track
|
||||
gon.generic = params[:generic]
|
||||
gon.instrument_id = instrument_id
|
||||
gon.env = Rails.env
|
||||
render 'individual_jamtrack', layout: 'web'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,13 @@ class UsersController < ApplicationController
|
|||
def new
|
||||
@no_user_dropdown = true
|
||||
if current_user
|
||||
redirect_to client_url
|
||||
if params["redirect-to"]
|
||||
redirect_to params["redirect-to"]
|
||||
else
|
||||
redirect_to client_url
|
||||
end
|
||||
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object @jam_track
|
||||
|
||||
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version, :duration, :year, :plan_code
|
||||
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version, :duration, :year, :plan_code, :allow_free
|
||||
|
||||
node :genres do |item|
|
||||
item.genres.select(:description).map(&:description)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object @jam_track
|
||||
|
||||
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version, :year, :duration
|
||||
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version, :year, :duration, :allow_free
|
||||
|
||||
child(:genres) {
|
||||
attributes :id, :description
|
||||
|
|
|
|||
|
|
@ -2,4 +2,8 @@ extends "api_shopping_carts/show"
|
|||
|
||||
node :show_free_jamtrack do
|
||||
any_user.show_free_jamtrack?
|
||||
end
|
||||
|
||||
node :fast_reedem do
|
||||
any_user.has_redeemable_jamtrack && any_user.shopping_carts.count == 1 && any_user.shopping_carts[0].free? && !any_user.mixed_cart
|
||||
end
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
%td.cart-item-caption
|
||||
{{cart.product_info.sale_display}}
|
||||
%td.cart-item-price
|
||||
$ {{Number(cart.product_info.real_price).toFixed(2)}}
|
||||
%span.cart-price $ {{Number(cart.product_info.real_price).toFixed(2)}}
|
||||
= "{% if(index == data.carts.length - 1) { %}"
|
||||
.shopping-sub-total
|
||||
%span.sub-total-text Subtotal:
|
||||
|
|
@ -56,6 +56,6 @@
|
|||
.clearall
|
||||
.right.actions
|
||||
%a.button-grey{href: "#"} HELP
|
||||
%a.button-orange{href: "/client#/jamtrack/search"} CONTINUE SHOPPING
|
||||
%a.button-orange.continue-shopping{href: "/client#/jamtrack/search"} CONTINUE SHOPPING
|
||||
%a.button-orange.proceed-checkout{href: "#"} PROCEED TO CHECKOUT
|
||||
.clearall
|
||||
|
|
@ -10,9 +10,10 @@
|
|||
p You don't have to sell anything. Just let your followers know about cool new stuff they'll like! To get started, simply review the affiliate agreement below, accept it (at the end of the agreement), and then start sharing links with your affiliate code. When referred users buy JamTracks, JamBlasters, JamLessons, and so on, you get paid!
|
||||
.column
|
||||
h1 Learn How to Make Money by Referring Users
|
||||
.video-wrapper
|
||||
.video-container
|
||||
iframe src="//www.youtube.com/embed/96YTnO_H9a4" frameborder="0" allowfullscreen
|
||||
- if !Rails.env.test?
|
||||
.video-wrapper
|
||||
.video-container
|
||||
iframe src="//www.youtube.com/embed/96YTnO_H9a4" frameborder="0" allowfullscreen
|
||||
br clear="all"
|
||||
.row
|
||||
h1 JamKazam Affiliate Agreement
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@
|
|||
| for your first JamTrack - free! Add it to your shopping cart, and we'll
|
||||
| make it free during the checkout process. Free offer good for 1 week only!
|
||||
.video-container
|
||||
iframe src="//www.youtube.com/embed/askHvcCoNfw" frameborder="0" allowfullscreen="allowfullscreen"
|
||||
- if !Rails.env.test?
|
||||
iframe src="//www.youtube.com/embed/askHvcCoNfw" frameborder="0" allowfullscreen="allowfullscreen"
|
||||
|
||||
a.go-jamtrack-shopping href="/client#/jamtrack/search" rel="external"
|
||||
| Shop for free
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ Rails.application.routes.draw do
|
|||
match '/reviews' => 'api_reviews#create', :via => :post
|
||||
match '/reviews/:id' => 'api_reviews#update', :via => :post
|
||||
match '/reviews/:id' => 'api_reviews#delete', :via => :delete
|
||||
match '/reviews/details/:review_summary_id' => 'api_users#details', :via => :get, :as => 'api_summary_reviews'
|
||||
match '/reviews/details/:review_summary_id' => 'api_reviews#details', :via => :get, :as => 'api_summary_reviews'
|
||||
|
||||
# recurly
|
||||
match '/recurly/create_account' => 'api_recurly#create_account', :via => :post
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ SitemapGenerator::Sitemap.create do
|
|||
add(recording_detail_path(recording.id), priority:0.8)
|
||||
end
|
||||
|
||||
Teacher.find_each do |teacher|
|
||||
if teacher.user
|
||||
add("/client#/profile/teacher/#{teacher.user.id}")
|
||||
end
|
||||
end
|
||||
|
||||
add(reset_password_path)
|
||||
add(corp_news_path)
|
||||
add(corp_media_center_path)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace :lessons do
|
|||
|
||||
|
||||
#lesson.accept({message: 'Yeah I got this', slot: slots[0]})
|
||||
#lesson.errors.any?.should be_false
|
||||
#lesson.errors.any?.should be false
|
||||
#lesson.reload
|
||||
#lesson.slot.should eql slots[0]
|
||||
#lesson.status.should eql LessonSession::STATUS_APPROVED
|
||||
|
|
@ -112,7 +112,7 @@ namespace :lessons do
|
|||
end
|
||||
|
||||
#lesson.accept({message: 'Yeah I got this', slot: slots[0]})
|
||||
#lesson.errors.any?.should be_false
|
||||
#lesson.errors.any?.should be false
|
||||
#lesson.reload
|
||||
#lesson.slot.should eql slots[0]
|
||||
#lesson.status.should eql LessonSession::STATUS_APPROVED
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Utils
|
|||
if recording_url =~ /^https?:\/\/.*soundcloud.com\/.+/
|
||||
tmpfile = Tempfile.new(site)
|
||||
tmpfile.close
|
||||
curl_args = "-A '#{USER_AGENT}' -L --output #{tmpfile.path} --fail --show-error "
|
||||
curl_args = "-A '#{USER_AGENT}' -L --output #{tmpfile.path} --fail --show-error "
|
||||
`curl #{curl_args} '#{recording_url}' 2>&1`
|
||||
result = File.read(tmpfile.path)
|
||||
File.delete(tmpfile.path)
|
||||
|
|
@ -80,7 +80,7 @@ class Utils
|
|||
end
|
||||
|
||||
def self.site_validator(url, site=nil)
|
||||
curl_args = "-A '#{USER_AGENT}' --silent --head --fail --show-error "
|
||||
curl_args = "-A '#{USER_AGENT}' --insecure --silent --head --fail --show-error "
|
||||
case site
|
||||
when 'bandcamp'
|
||||
cmd = "curl #{curl_args} '#{url}' 2>&1"
|
||||
|
|
|
|||
|
|
@ -73,10 +73,7 @@ describe ApiReviewsController, type: :controller do
|
|||
get :index, format: 'json'
|
||||
response.should be_success
|
||||
json = JSON.parse(response.body)
|
||||
json.should have(0).items
|
||||
|
||||
ReviewSummary.index.should have(0).items
|
||||
Review.reduce()
|
||||
ReviewSummary.index.should have(2).items
|
||||
get :index, format: 'json'
|
||||
json = JSON.parse(response.body)
|
||||
|
|
@ -84,8 +81,6 @@ describe ApiReviewsController, type: :controller do
|
|||
end
|
||||
|
||||
it "details" do
|
||||
ReviewSummary.index.should have(0).items
|
||||
Review.reduce()
|
||||
ReviewSummary.index.should have(2).items
|
||||
|
||||
summaries = ReviewSummary.index
|
||||
|
|
@ -101,8 +96,6 @@ describe ApiReviewsController, type: :controller do
|
|||
end
|
||||
|
||||
it "paginates details" do
|
||||
ReviewSummary.index.should have(0).items
|
||||
Review.reduce()
|
||||
summaries = ReviewSummary.index
|
||||
summaries.should have(2).items
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe ApiSchoolsController, type: :controller do
|
|||
describe "update" do
|
||||
|
||||
it "works" do
|
||||
post :update, id: school.id, name: "Hardy har", scheduling_communication: 'school'
|
||||
post :update, id: school.id, name: "Hardy har", scheduling_communication: 'school', format: 'json'
|
||||
response.should be_success
|
||||
json = JSON.parse(response.body)
|
||||
json['name'].should eql "Hardy har"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe ApiShoppingCartsController, type: :controller do
|
|||
|
||||
it "index" do
|
||||
cart = ShoppingCart.create(user, jam_track)
|
||||
cart.errors.any?.should be_false
|
||||
cart.errors.any?.should be false
|
||||
user.reload
|
||||
user.shopping_carts.count.should eq(1)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,26 +42,28 @@ describe ApiTeachersController, type: :controller do
|
|||
it "simple" do
|
||||
post :create, biography: BIO, format: 'json'
|
||||
response.should be_success
|
||||
t = Teacher.find_by_user_id(user)
|
||||
t.should_not be_nil
|
||||
user.reload
|
||||
user.teacher.should_not be_nil
|
||||
|
||||
t.biography.should == BIO
|
||||
user.teacher.biography.should == BIO
|
||||
end
|
||||
|
||||
|
||||
it "with instruments" do
|
||||
post :create, biography: BIO, instruments: [instrument1, instrument2], format: 'json'
|
||||
response.should be_success
|
||||
t = Teacher.find_by_user_id(user)
|
||||
user.reload
|
||||
user.teacher.should_not be_nil
|
||||
t = user.teacher
|
||||
t.biography.should == BIO
|
||||
t.instruments.should have(2).items
|
||||
end
|
||||
|
||||
it "with child records" do
|
||||
params = {
|
||||
subjects: [subject1, subject2],
|
||||
genres: [genre1, genre2],
|
||||
languages: [language1, language2],
|
||||
subjects: [subject1.id, subject2.id],
|
||||
genres: [genre1.id, genre2.id],
|
||||
languages: [language1.id, language2.id],
|
||||
teaches_age_lower: 10,
|
||||
teaches_age_upper: 20,
|
||||
teaches_beginner: true,
|
||||
|
|
@ -73,7 +75,9 @@ describe ApiTeachersController, type: :controller do
|
|||
post :create, params
|
||||
|
||||
response.should be_success
|
||||
t = Teacher.find_by_user_id(user)
|
||||
user.reload
|
||||
user.teacher.should_not be_nil
|
||||
t = user.teacher
|
||||
|
||||
# Genres
|
||||
t.genres.should have(2).items
|
||||
|
|
@ -86,9 +90,9 @@ describe ApiTeachersController, type: :controller do
|
|||
|
||||
t.teaches_age_lower.should == 10
|
||||
t.teaches_age_upper.should == 20
|
||||
t.teaches_beginner.should be_true
|
||||
t.teaches_intermediate.should be_false
|
||||
t.teaches_advanced.should be_true
|
||||
t.teaches_beginner.should be true
|
||||
t.teaches_intermediate.should be false
|
||||
t.teaches_advanced.should be true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -161,8 +165,8 @@ describe ApiTeachersController, type: :controller do
|
|||
it "deletes" do
|
||||
delete :delete, {:format => 'json', id: @teacher.id}
|
||||
response.should be_success
|
||||
t = Teacher.find_by_user_id(user)
|
||||
t.should be_nil
|
||||
user.reload
|
||||
user.teacher.should be_nil
|
||||
end
|
||||
|
||||
it "with child records" do
|
||||
|
|
@ -182,7 +186,9 @@ describe ApiTeachersController, type: :controller do
|
|||
post :update, params
|
||||
|
||||
response.should be_success
|
||||
t = Teacher.find_by_user_id(user)
|
||||
user.reload
|
||||
user.teacher.should_not be_nil
|
||||
t = user.teacher
|
||||
|
||||
# Genres
|
||||
t.genres.should have(2).items
|
||||
|
|
@ -195,9 +201,9 @@ describe ApiTeachersController, type: :controller do
|
|||
|
||||
t.teaches_age_lower.should == 10
|
||||
t.teaches_age_upper.should == 20
|
||||
t.teaches_beginner.should be_true
|
||||
t.teaches_intermediate.should be_false
|
||||
t.teaches_advanced.should be_true
|
||||
t.teaches_beginner.should be true
|
||||
t.teaches_intermediate.should be false
|
||||
t.teaches_advanced.should be true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -148,12 +148,10 @@ describe ApiUsersController, type: :controller do
|
|||
found.last_jam_locidispid.should_not be_nil
|
||||
end
|
||||
|
||||
it "no first name" do
|
||||
it "no first name is OK" do
|
||||
email = 'user_create2@jamkazam.com'
|
||||
post :create, first_name: nil, last_name: 'Call', email: email, password: 'jam123', terms: true, format: 'json'
|
||||
response.status.should eq(422)
|
||||
error_data = JSON.parse(response.body)
|
||||
error_data['errors']['first_name'].should eq(["can't be blank"])
|
||||
response.status.should eq(201)
|
||||
end
|
||||
|
||||
it "no email" do
|
||||
|
|
|
|||
|
|
@ -273,17 +273,17 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
factory :genre, :class => JamRuby::Genre do
|
||||
description { |n| "Genre #{n}" }
|
||||
sequence(:description) { |n| "Genre #{n}" }
|
||||
end
|
||||
|
||||
factory :language, :class => JamRuby::Language do
|
||||
id { |n| "Language #{n}" }
|
||||
description { |n| "Language #{n}" }
|
||||
sequence(:id) { |n| "Language_#{n}" }
|
||||
sequence(:description) { |n| "Language #{n}" }
|
||||
end
|
||||
|
||||
factory :subject, :class => JamRuby::Subject do
|
||||
id { |n| "Subject #{n}" }
|
||||
description { |n| "Subject #{n}" }
|
||||
sequence(:id) { |n| "Subject_#{n}" }
|
||||
sequence(:description) { |n| "Subject #{n}" }
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
=begin
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Alternate Landing Pages", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
|
@ -47,3 +48,4 @@ describe "Alternate Landing Pages", :js => true, :type => :feature, :capybara_fe
|
|||
|
||||
|
||||
end
|
||||
=end
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@ describe "Book Monthly Recurring Lesson", :js => true, :type => :feature, :capyb
|
|||
before(:each) do
|
||||
|
||||
|
||||
LessonPackagePurchase.destroy_all
|
||||
LessonBooking.destroy_all
|
||||
Recording.delete_all
|
||||
Diagnostic.delete_all
|
||||
User.delete_all
|
||||
Recording.destroy_all
|
||||
Diagnostic.destroy_all
|
||||
User.destroy_all
|
||||
|
||||
UserMailer.deliveries.clear
|
||||
emulate_client
|
||||
|
|
@ -85,8 +86,8 @@ describe "Book Monthly Recurring Lesson", :js => true, :type => :feature, :capyb
|
|||
|
||||
user.student_lesson_bookings.count.should eql 2
|
||||
lesson_booking = user.student_lesson_bookings.order(:created_at).last
|
||||
lesson_booking.is_requested?.should be_true
|
||||
lesson_booking.card_presumed_ok.should be_true
|
||||
lesson_booking.is_requested?.should be true
|
||||
lesson_booking.card_presumed_ok.should be true
|
||||
lesson_booking.recurring.should be true
|
||||
lesson_booking.is_monthly_payment?.should be true
|
||||
|
||||
|
|
@ -179,12 +180,12 @@ describe "Book Monthly Recurring Lesson", :js => true, :type => :feature, :capyb
|
|||
|
||||
LessonSession.hourly_check
|
||||
lesson_session1.reload
|
||||
lesson_session1.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session1.analysis)
|
||||
lesson_session1.analysed.should be true
|
||||
analysis = lesson_session1.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
|
||||
lesson_session1.billing_attempts.should be_true
|
||||
lesson_session1.billing_attempts.should be true
|
||||
lesson_session1.billed.should eql false
|
||||
lesson_session1.success.should be_true
|
||||
lesson_session1.success.should be true
|
||||
|
||||
user.lesson_purchases.count.should eql 1
|
||||
|
||||
|
|
@ -195,14 +196,14 @@ describe "Book Monthly Recurring Lesson", :js => true, :type => :feature, :capyb
|
|||
lesson_package_purchase = user.lesson_purchases.where(teacher_id: teacher_user.id).last
|
||||
teacher_distribution = lesson_package_purchase.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 3000 / 2
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.distributed.should be_false
|
||||
lesson_package_purchase.lesson_payment_charge.billed.should be_true
|
||||
teacher_distribution.ready.should be true
|
||||
teacher_distribution.distributed.should be false
|
||||
lesson_package_purchase.lesson_payment_charge.billed.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.amount_in_cents.should eql 3000/2 + (3000/2 * 0.0825).round
|
||||
lesson_package_purchase.lesson_payment_charge.fee_in_cents.should eql 0
|
||||
lesson_package_purchase.lesson_payment_charge.stripe_charge_id.should_not be_nil
|
||||
lesson_package_purchase.lesson_payment_charge.post_processed.should be_true
|
||||
lesson_package_purchase.lesson_payment_charge.sent_billing_notices.should be_true
|
||||
lesson_package_purchase.lesson_payment_charge.post_processed.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.sent_billing_notices.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.billing_attempts.should eql 1
|
||||
|
||||
lesson_session1.reload
|
||||
|
|
@ -218,12 +219,12 @@ describe "Book Monthly Recurring Lesson", :js => true, :type => :feature, :capyb
|
|||
lesson_package_purchase = user.lesson_purchases.last
|
||||
teacher_distribution = lesson_package_purchase.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 3000
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.ready.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.amount_in_cents.should eql 3000 + (3000 * 0.0825).round
|
||||
lesson_package_purchase.lesson_payment_charge.fee_in_cents.should eql 0
|
||||
lesson_package_purchase.lesson_payment_charge.stripe_charge_id.should_not be_nil
|
||||
lesson_package_purchase.lesson_payment_charge.post_processed.should be_true
|
||||
lesson_package_purchase.lesson_payment_charge.sent_billing_notices.should be_true
|
||||
lesson_package_purchase.lesson_payment_charge.post_processed.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.sent_billing_notices.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.billing_attempts.should eql 1
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ describe "Book Single Recurring Lesson", :js => true, :type => :feature, :capyba
|
|||
|
||||
user.student_lesson_bookings.count.should eql 2
|
||||
lesson_booking = user.student_lesson_bookings.order(:created_at).last
|
||||
lesson_booking.is_requested?.should be_true
|
||||
lesson_booking.card_presumed_ok.should be_true
|
||||
lesson_booking.is_requested?.should be true
|
||||
lesson_booking.card_presumed_ok.should be true
|
||||
lesson_booking.recurring.should be true
|
||||
lesson_booking.is_monthly_payment?.should be false
|
||||
|
||||
|
|
@ -184,18 +184,18 @@ describe "Book Single Recurring Lesson", :js => true, :type => :feature, :capyba
|
|||
|
||||
LessonSession.hourly_check
|
||||
lesson_session1.reload
|
||||
lesson_session1.analysed.should be_true
|
||||
lesson_session1.analysed.should be true
|
||||
analysis = JSON.parse(lesson_session1.analysis)
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
|
||||
lesson_session1.billing_attempts.should be_true
|
||||
lesson_session1.billing_attempts.should be true
|
||||
lesson_session1.billed.should eql true
|
||||
lesson_session1.success.should be_true
|
||||
lesson_session1.lesson_payment_charge.billed.should be_true
|
||||
lesson_session1.success.should be true
|
||||
lesson_session1.lesson_payment_charge.billed.should be true
|
||||
lesson_session1.lesson_payment_charge.amount_in_cents.should eql (3000 + (3000 * 0.0825).round)
|
||||
lesson_session1.lesson_payment_charge.fee_in_cents.should eql 0
|
||||
lesson_session1.lesson_payment_charge.stripe_charge_id.should_not be_nil
|
||||
lesson_session1.lesson_payment_charge.post_processed.should be_true
|
||||
lesson_session1.lesson_payment_charge.sent_billing_notices.should be_true
|
||||
lesson_session1.lesson_payment_charge.post_processed.should be true
|
||||
lesson_session1.lesson_payment_charge.sent_billing_notices.should be true
|
||||
lesson_session1.lesson_payment_charge.billing_attempts.should eql 1
|
||||
|
||||
LessonBooking.hourly_check
|
||||
|
|
@ -203,17 +203,17 @@ describe "Book Single Recurring Lesson", :js => true, :type => :feature, :capyba
|
|||
lesson_session1.reload
|
||||
teacher_distribution = lesson_session1.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 3000
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.distributed.should be_false
|
||||
teacher_distribution.ready.should be true
|
||||
teacher_distribution.distributed.should be false
|
||||
|
||||
# check the second session, which hasn't come due yet because it's 1 week ahead of the other session
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_true
|
||||
lesson_session2.analysed.should be true
|
||||
analysis = JSON.parse(lesson_session2.analysis)
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SESSION_ONGOING
|
||||
lesson_session2.billing_attempts.should eql 0
|
||||
lesson_session2.billed.should eql false
|
||||
lesson_session2.success.should be_false
|
||||
lesson_session2.success.should be false
|
||||
lesson_session2.teacher_distribution.should be_nil
|
||||
|
||||
failed_lesson(lesson_session2)
|
||||
|
|
@ -223,12 +223,12 @@ describe "Book Single Recurring Lesson", :js => true, :type => :feature, :capyba
|
|||
|
||||
# check the 2nd session again, which should now have
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_true
|
||||
lesson_session2.analysed.should be true
|
||||
analysis = JSON.parse(lesson_session2.analysis)
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SESSION_ONGOING
|
||||
lesson_session2.billing_attempts.should eql 0
|
||||
lesson_session2.billed.should eql false
|
||||
lesson_session2.success.should be_false
|
||||
lesson_session2.success.should be false
|
||||
lesson_session2.teacher_distribution.should be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
subject { page }
|
||||
|
||||
let(:user) { FactoryGirl.create(:user, traditional_band: true,paid_sessions: true, paid_sessions_hourly_rate: 1, paid_sessions_daily_rate:1 ) }
|
||||
let(:user) { FactoryGirl.create(:user, traditional_band: true,paid_sessions: true, paid_sessions_hourly_rate: 1, paid_sessions_daily_rate:1 ) }
|
||||
let(:teacher_user) {FactoryGirl.create(:teacher_user, first_name: "Teacher1", ready_for_session_at: Time.now)}
|
||||
let(:teacher_user2) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now)}
|
||||
let(:teacher_user3) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now)}
|
||||
|
|
@ -14,9 +14,9 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
before(:each) do
|
||||
LessonPackagePurchase.destroy_all
|
||||
LessonBooking.destroy_all
|
||||
Recording.delete_all
|
||||
Diagnostic.delete_all
|
||||
User.delete_all
|
||||
Recording.destroy_all
|
||||
Diagnostic.destroy_all
|
||||
User.destroy_all
|
||||
|
||||
UserMailer.deliveries.clear
|
||||
emulate_client
|
||||
|
|
@ -82,15 +82,15 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
user.stripe_customer_id.should_not be_nil
|
||||
user.student_lesson_bookings.count.should eql 2 # this single one, and the test drive created in the before section of the test
|
||||
lesson_booking = user.student_lesson_bookings.order(:created_at).last
|
||||
lesson_booking.is_requested?.should be_true
|
||||
lesson_booking.card_presumed_ok.should be_true
|
||||
lesson_booking.is_requested?.should be true
|
||||
lesson_booking.card_presumed_ok.should be true
|
||||
lesson_booking.recurring.should be false
|
||||
|
||||
|
||||
|
||||
lesson_booking = LessonBooking.where(teacher_id: teacher_user).order(:created_at).last
|
||||
lesson_booking.should_not be_nil
|
||||
lesson_booking.same_school.should be_false
|
||||
lesson_booking.same_school.should be false
|
||||
lesson_session = LessonSession.where(teacher_id: teacher_user).order(:created_at).last
|
||||
lesson_session.teacher.should eql teacher_user
|
||||
|
||||
|
|
@ -170,10 +170,10 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
LessonSession.hourly_check
|
||||
lesson_session1.reload
|
||||
lesson_session1.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session1.analysis)
|
||||
lesson_session1.analysed.should be true
|
||||
analysis = lesson_session1.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
|
||||
lesson_session1.success.should be_true
|
||||
lesson_session1.success.should be true
|
||||
lesson_session1.billing_attempts.should eql 1
|
||||
lesson_session1.billed.should eql true
|
||||
|
||||
|
|
@ -182,14 +182,14 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
lesson_session1.reload
|
||||
teacher_distribution = lesson_session1.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 3000
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.distributed.should be_false
|
||||
teacher_distribution.ready.should be true
|
||||
teacher_distribution.distributed.should be false
|
||||
|
||||
# check the second session, which no one went too
|
||||
|
||||
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_false
|
||||
lesson_session2.analysed.should be false
|
||||
|
||||
# approve by teacher:
|
||||
teacher_approve(lesson_session2)
|
||||
|
|
@ -197,12 +197,12 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
LessonBooking.hourly_check
|
||||
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session2.analysis)
|
||||
lesson_session2.analysed.should be true
|
||||
analysis = lesson_session2.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::TEACHER_FAULT
|
||||
lesson_session2.billing_attempts.should eql 0
|
||||
lesson_session2.billed.should eql false
|
||||
lesson_session2.success.should be_false
|
||||
lesson_session2.success.should be false
|
||||
|
||||
lesson_session2.teacher_distribution.should be_nil
|
||||
end
|
||||
|
|
@ -253,8 +253,8 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
user.student_lesson_bookings.count.should eql 1 # this single one
|
||||
lesson_booking = user.student_lesson_bookings.order(:created_at).last
|
||||
lesson_booking.is_requested?.should be_true
|
||||
lesson_booking.card_presumed_ok.should be_false
|
||||
lesson_booking.is_requested?.should be true
|
||||
lesson_booking.card_presumed_ok.should be false
|
||||
lesson_booking.recurring.should be false
|
||||
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
lesson_booking = LessonBooking.where(teacher_id: teacher_user).order(:created_at).last
|
||||
lesson_booking.should_not be_nil
|
||||
lesson_booking.school.should eql school
|
||||
lesson_booking.same_school.should be_true
|
||||
lesson_booking.same_school.should be true
|
||||
lesson_session = LessonSession.where(teacher_id: teacher_user).order(:created_at).last
|
||||
lesson_session.teacher.should eql teacher_user
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
visit "/client#/teachers/search"
|
||||
find('span.search-summary', text: 'From My School Only')
|
||||
find('a.teacher-search-options').trigger(:click)
|
||||
find('input.onlyMySchool').trigger(:click) # uncheck
|
||||
find('.icheckbox_minimal.onlyMySchool ins', visible: false).trigger(:click) # uncheck
|
||||
find('a.search-btn').trigger(:click)
|
||||
find('span.search-summary', text: 'all teachers')
|
||||
find('.teacher-search-result[data-teacher-id="' + teacher_user2.id + '"] .try-test-drive').trigger(:click)
|
||||
|
|
@ -313,11 +313,11 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
find('a.button-orange', text:'CLOSE').trigger(:click)
|
||||
|
||||
user.reload
|
||||
user.has_stored_credit_card?.should be_true
|
||||
user.has_stored_credit_card?.should be true
|
||||
lesson_session1 = lesson_session
|
||||
lesson_booking = LessonBooking.where(teacher_id: teacher_user2.id).first
|
||||
lesson_booking.should_not be_nil
|
||||
lesson_booking.card_presumed_ok.should be_true
|
||||
lesson_booking.card_presumed_ok.should be true
|
||||
lesson_session = LessonSession.where(teacher_id: teacher_user2.id).first
|
||||
lesson_session.teacher.should eql teacher_user2
|
||||
lesson_session2 = lesson_session
|
||||
|
|
@ -338,10 +338,10 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
LessonSession.hourly_check
|
||||
lesson_session1.reload
|
||||
lesson_session1.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session1.analysis)
|
||||
lesson_session1.analysed.should be true
|
||||
analysis = lesson_session1.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
|
||||
lesson_session1.success.should be_true
|
||||
lesson_session1.success.should be true
|
||||
lesson_session1.billing_attempts.should eql nil
|
||||
lesson_session1.billed.should eql false
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
|
||||
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_false
|
||||
lesson_session2.analysed.should be false
|
||||
|
||||
# approve by teacher:
|
||||
teacher_approve(lesson_session2)
|
||||
|
|
@ -363,12 +363,12 @@ describe "Single Lesson", :js => true, :type => :feature, :capybara_feature => t
|
|||
LessonBooking.hourly_check
|
||||
|
||||
lesson_session2.reload
|
||||
lesson_session2.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session2.analysis)
|
||||
lesson_session2.analysed.should be true
|
||||
analysis = lesson_session2.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::TEACHER_FAULT
|
||||
lesson_session2.billing_attempts.should eql 0
|
||||
lesson_session2.billed.should eql false
|
||||
lesson_session2.success.should be_false
|
||||
lesson_session2.success.should be false
|
||||
|
||||
lesson_session2.teacher_distribution.should be_nil
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
|
|||
let(:teacher_user2) {FactoryGirl.create(:teacher_user, ready_for_session_at: Time.now)}
|
||||
|
||||
before(:each) do
|
||||
LessonPackagePurchase.destroy_all
|
||||
LessonBooking.destroy_all
|
||||
Recording.delete_all
|
||||
Diagnostic.delete_all
|
||||
User.delete_all
|
||||
Recording.destroy_all
|
||||
Diagnostic.destroy_all
|
||||
User.destroy_all
|
||||
|
||||
UserMailer.deliveries.clear
|
||||
emulate_client
|
||||
|
|
@ -48,7 +49,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
|
|||
fill_out_payment('This purchase entitles you to take 4 private online music')
|
||||
|
||||
# we tell user they have test drive purchased, and take them to the teacher screen
|
||||
find('#banner h1', text: 'Test Drive Purchased')
|
||||
find('#banner h1', text: 'TestDrive Purchased')
|
||||
find('#banner .dialog-inner', text: "You have purchased #{4} TestDrive credits and have used 1 credit to request a JamClass with #{teacher_user.name}")
|
||||
|
||||
# dismiss banner
|
||||
|
|
@ -57,7 +58,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
|
|||
# validate that we made a test drive purchase
|
||||
lesson_package_purchase = LessonPackagePurchase.where(user_id: user.id).first
|
||||
lesson_package_purchase.should_not be_nil
|
||||
lesson_package_purchase.lesson_package_type.is_test_drive?.should be_true
|
||||
lesson_package_purchase.lesson_package_type.is_test_drive?.should be true
|
||||
lesson_package_purchase.lesson_payment_charge.should be_nil
|
||||
user.reload
|
||||
user.remaining_test_drives.should eql 3
|
||||
|
|
@ -72,7 +73,7 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
|
|||
user.reload
|
||||
user.student_lesson_bookings.count.should eql 1
|
||||
lesson_booking = user.student_lesson_bookings.first
|
||||
lesson_booking.is_requested?.should be_true
|
||||
lesson_booking.is_requested?.should be true
|
||||
user.remaining_test_drives.should eql 3
|
||||
lesson_booking.lesson_sessions.count.should eql 1
|
||||
lesson_session1 = lesson_booking.lesson_sessions.first
|
||||
|
|
@ -110,20 +111,20 @@ describe "Test Drive", :js => true, :type => :feature, :capybara_feature => true
|
|||
|
||||
LessonSession.hourly_check
|
||||
lesson_session1.reload
|
||||
lesson_session1.analysed.should be_true
|
||||
analysis = JSON.parse(lesson_session1.analysis)
|
||||
lesson_session1.analysed.should be true
|
||||
analysis = lesson_session1.analysis
|
||||
analysis["reason"].should eql LessonSessionAnalyser::SUCCESS
|
||||
lesson_session1.billing_attempts.should be_nil
|
||||
lesson_session1.billed.should eql false
|
||||
lesson_session1.success.should be_true
|
||||
lesson_session1.success.should be true
|
||||
|
||||
LessonBooking.hourly_check
|
||||
|
||||
lesson_session1.reload
|
||||
teacher_distribution = lesson_session1.teacher_distribution
|
||||
teacher_distribution.amount_in_cents.should eql 1000
|
||||
teacher_distribution.ready.should be_true
|
||||
teacher_distribution.distributed.should be_false
|
||||
teacher_distribution.ready.should be true
|
||||
teacher_distribution.distributed.should be false
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
|
||||
before(:each) do
|
||||
AffiliateDistribution.delete_all
|
||||
ShoppingCart.delete_all
|
||||
SaleLineItem.delete_all
|
||||
Sale.delete_all
|
||||
User.delete_all
|
||||
|
||||
|
|
@ -67,6 +69,8 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
end
|
||||
end
|
||||
end
|
||||
@jamtrack_pearljam_evenflow.allow_free = true
|
||||
@jamtrack_pearljam_evenflow.save!
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -191,7 +195,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
# fill in user/email/tos
|
||||
fill_in 'email', with: 'seth@jamkazam.com'
|
||||
fill_in 'password', with: 'jam123'
|
||||
find('#divJamKazamTos ins.iCheck-helper').trigger(:click) # accept TOS
|
||||
find('#divJamKazamTos ins.iCheck-helper', visible:false).trigger(:click) # accept TOS
|
||||
|
||||
# try to submit, and see order page
|
||||
find('#payment-info-next').trigger(:click)
|
||||
|
|
@ -208,7 +212,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
find('p.payment-prompt.free-jamtrack')
|
||||
|
||||
expect(page).to_not have_selector('.jamkazam-account-signup')
|
||||
page.should_not have_selector('.jamkazam-account-signup')
|
||||
|
||||
# fill out all billing info, but not account info
|
||||
fill_in 'billing-first-name', with: 'Seth'
|
||||
|
|
@ -232,7 +236,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
find('p.payment-prompt.free-jamtrack')
|
||||
|
||||
expect(page).to_not have_selector('.jamkazam-account-signup')
|
||||
page.should_not have_selector('.jamkazam-account-signup')
|
||||
|
||||
# try to submit, and see slew of errors
|
||||
find('#payment-info-next').trigger(:click)
|
||||
|
|
@ -268,8 +272,8 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
find('p.payment-prompt.free-jamtrack')
|
||||
|
||||
expect(page).to_not have_selector('.jamkazam-account-signup')
|
||||
expect(page).to_not have_selector('.payment-prompt.already-entered')
|
||||
page.should_not have_selector('.jamkazam-account-signup')
|
||||
page.should_not have_selector('.payment-prompt.already-entered')
|
||||
|
||||
# fill out all billing info, but not account info
|
||||
fill_in 'billing-first-name', with: 'Seth'
|
||||
|
|
@ -280,7 +284,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
fill_in 'billing-zip', with: '78759'
|
||||
fill_in 'card-number', with: '4111111111111111'
|
||||
fill_in 'card-verify', with: '012'
|
||||
find('.save-card-checkbox ins.iCheck-helper').trigger(:click) # don't accept re-use card default
|
||||
find('.save-card-checkbox ins.iCheck-helper', visible:false).trigger(:click) # don't accept re-use card default
|
||||
|
||||
# try to submit, and see order page
|
||||
find('#payment-info-next').trigger(:click)
|
||||
|
|
@ -291,9 +295,9 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
# sneak in an extra test... let's hit BACK and confirm that the temporary 'just entered billing info' screen is showing
|
||||
visit '/client#/checkoutPayment'
|
||||
find('.payment-prompt.already-entered')
|
||||
expect(page).to_not have_selector('.payment-prompt.no-free-jamtrack')
|
||||
expect(page).to_not have_selector('.payment-prompt.free-jamtrack')
|
||||
expect(page).to_not have_selector('#checkout-payment-info')
|
||||
page.should_not have_selector('.payment-prompt.no-free-jamtrack')
|
||||
page.should_not have_selector('.payment-prompt.free-jamtrack')
|
||||
page.should_not have_selector('#checkout-payment-info')
|
||||
|
||||
|
||||
user.reload
|
||||
|
|
@ -330,11 +334,11 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
have_field('card-verify', disabled: true)
|
||||
|
||||
# verify that the use current card checkbox is checked, and that the 'save card' checkbox is checking
|
||||
find('#reuse-existing-card').checked?.should be true
|
||||
find('#save-card:checked').checked?.should be true
|
||||
find('#reuse-existing-card', visible:false).checked?.should be true
|
||||
find('#save-card:checked', visible:false).checked?.should be true
|
||||
|
||||
# then uncheck 'reuse-existing-card', which should re-enable all the fields that were just disabled
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper').trigger(:click)
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper', visible: false).trigger(:click)
|
||||
|
||||
# verify that all billing info looks enabled now, since 'reuse-existing-card' was unchecked
|
||||
have_field('billing-first-name', disabled: false)
|
||||
|
|
@ -357,7 +361,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
fill_in 'billing-address1', with: '10702 Buckthorn Drive'
|
||||
|
||||
# flip it back to reuse existing
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper').trigger(:click)
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper', visible: false).trigger(:click)
|
||||
|
||||
# hit next... we should move on to the payment screen
|
||||
|
||||
|
|
@ -392,11 +396,11 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
find('p.payment-prompt.free-jamtrack')
|
||||
|
||||
# verify that the use current card checkbox is checked, and that the 'save card' checkbox is checking
|
||||
find('#reuse-existing-card').checked?.should be true
|
||||
find('#save-card:checked').checked?.should be true
|
||||
find('#reuse-existing-card', visible: false).checked?.should be true
|
||||
find('#save-card:checked', visible: false).checked?.should be true
|
||||
|
||||
# then uncheck 'reuse-existing-card', which should re-enable all the fields that were just disabled
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper').trigger(:click)
|
||||
find('.reuse-existing-card-checkbox ins.iCheck-helper', visible: false).trigger(:click)
|
||||
|
||||
# ok, we want to fiddle some values, and later prove that they will be ignored once we set reuse-existing-card back to checked
|
||||
fill_in 'billing-first-name', with: 'Bobby'
|
||||
|
|
@ -502,7 +506,10 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
end
|
||||
|
||||
it "shows one free, one not free item correctly (not-Texas)" do
|
||||
pending "not possible to have one free and one not-free in shopping cart currently"
|
||||
|
||||
jamtrack_pearljam_evenflow.allow_free = false
|
||||
jamtrack_pearljam_evenflow.save!
|
||||
|
||||
ShoppingCart.add_jam_track_to_cart(user, jamtrack_acdc_backinblack)
|
||||
user.reload
|
||||
ShoppingCart.add_jam_track_to_cart(user, jamtrack_pearljam_evenflow)
|
||||
|
|
@ -526,7 +533,10 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
end
|
||||
|
||||
it "shows one free, one not free item correctly (Texas)" do
|
||||
pending "not possible to have one free and one not-free in shopping cart currently"
|
||||
jamtrack_pearljam_evenflow.allow_free = false
|
||||
jamtrack_pearljam_evenflow.save!
|
||||
|
||||
|
||||
ShoppingCart.add_jam_track_to_cart(user, jamtrack_acdc_backinblack)
|
||||
user.reload
|
||||
ShoppingCart.add_jam_track_to_cart(user, jamtrack_pearljam_evenflow)
|
||||
|
|
@ -839,7 +849,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
fill_in "email", with: 'testuser_12345@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.register-area ins').trigger(:click)
|
||||
find('.register-area input[type="checkbox"]', visible:false).trigger(:click)
|
||||
find('button.cta-button', text: 'GET IT FREE!').trigger(:click)
|
||||
|
||||
# this should show on the /client#/jamtrack page
|
||||
|
|
@ -1230,7 +1240,7 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
|
||||
describe "gift cards" do
|
||||
|
||||
it "user has both redeemable jamtrack and gift card jamtracks" do
|
||||
it "user has both redeemable jamtrack and gift card jamtracks, checks out one at a time" do
|
||||
|
||||
jamtrack_led_zeppelin_kashmir.touch
|
||||
jamtrack_pearljam_evenflow.touch
|
||||
|
|
@ -1243,34 +1253,94 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_acdc_backinblack.id}\"]", text: 'GET IT FREE!').trigger(:click)
|
||||
find('.jam-tracks-in-browser')
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be_false
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.jam_track_rights.count.should eql 1
|
||||
|
||||
find('a.back-to-browsing').trigger(:click)
|
||||
find('h1', text: 'search jamtracks')
|
||||
find('.search-controls .Select-control').trigger(:mousedown)
|
||||
go_to_root
|
||||
#find('a.back-to-browsing').trigger(:click)
|
||||
#find('h1', text: 'search jamtracks')
|
||||
#find('.search-controls .Select-control').trigger(:mousedown)
|
||||
## wait for the 'Type to search' prompt to show
|
||||
#find('.search-controls .Select-search-prompt')
|
||||
#find('.search-by-string-btn').trigger(:click)
|
||||
|
||||
visit "/client#/jamtrack/search"
|
||||
find('#jamtrackSearch .Select-control').trigger(:mousedown)
|
||||
# wait for the 'Type to search' prompt to show
|
||||
find('.search-controls .Select-search-prompt')
|
||||
find('.search-by-string-btn').trigger(:click)
|
||||
find('#jamtrackSearch .Select-search-prompt')
|
||||
send_key_sequence('#jamtrackSearch .Select-control', '')
|
||||
find('#jamtrackSearch .search-btn').trigger(:click)
|
||||
|
||||
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jamtrack_led_zeppelin_kashmir.id + '"]')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_led_zeppelin_kashmir.id}\"]", text: 'GET IT FREE!').trigger(:click)
|
||||
find('.jam-tracks-in-browser')
|
||||
#find('.jam-tracks-in-browser')
|
||||
find('h1', text: 'shopping cart')
|
||||
sleep 2
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be_false
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.gifted_jamtracks.should eq(1)
|
||||
|
||||
find('a.back-to-browsing').trigger(:click)
|
||||
find('h1', text: 'search jamtracks')
|
||||
find('.search-controls .Select-control').trigger(:mousedown)
|
||||
find('a.button-orange', text: 'PROCEED TO CHECKOUT').trigger(:click)
|
||||
|
||||
find('.jam-tracks-in-browser')
|
||||
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.jam_track_rights.count.should eql 2
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
end
|
||||
|
||||
it "user has both redeemable jamtrack and gift card jamtracks, all at once" do
|
||||
|
||||
jamtrack_led_zeppelin_kashmir.touch
|
||||
jamtrack_pearljam_evenflow.touch
|
||||
|
||||
user.gifted_jamtracks = 1
|
||||
user.save!
|
||||
|
||||
fast_signin(user, "/client?song=#{jamtrack_acdc_backinblack.name}#/jamtrack/search")
|
||||
find('h1', text: 'jamtracks')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_acdc_backinblack.id}\"]", text: 'GET IT FREE!').trigger(:click)
|
||||
find('.jam-tracks-in-browser')
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
|
||||
go_to_root
|
||||
#find('a.back-to-browsing').trigger(:click)
|
||||
#find('h1', text: 'search jamtracks')
|
||||
#find('.search-controls .Select-control').trigger(:mousedown)
|
||||
## wait for the 'Type to search' prompt to show
|
||||
#find('.search-controls .Select-search-prompt')
|
||||
#find('.search-by-string-btn').trigger(:click)
|
||||
|
||||
visit "/client#/jamtrack/search"
|
||||
find('#jamtrackSearch .Select-control').trigger(:mousedown)
|
||||
# wait for the 'Type to search' prompt to show
|
||||
find('.search-controls .Select-search-prompt')
|
||||
find('.search-by-string-btn').trigger(:click)
|
||||
find('#jamtrackSearch .Select-search-prompt')
|
||||
send_key_sequence('#jamtrackSearch .Select-control', '')
|
||||
find('#jamtrackSearch .search-btn').trigger(:click)
|
||||
|
||||
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jamtrack_led_zeppelin_kashmir.id + '"]')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_led_zeppelin_kashmir.id}\"]", text: 'GET IT FREE!').trigger(:click)
|
||||
#find('.jam-tracks-in-browser')
|
||||
find('h1', text: 'shopping cart')
|
||||
sleep 2
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.gifted_jamtracks.should eq(1)
|
||||
|
||||
find('a.continue-shopping').trigger(:click)
|
||||
find('h1', text: 'search jamtracks')
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jamtrack_pearljam_evenflow.id + '"]')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_pearljam_evenflow.id}\"]", text: 'ADD TO CART').trigger(:click)
|
||||
|
||||
find('h1', text: 'shopping cart')
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_pearljam_evenflow.name}")
|
||||
find('.cart-item-price', text: "$ #{jamtrack_pearljam_evenflow.price}")
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_led_zeppelin_kashmir.name}")
|
||||
find('.cart-price', text: "$ 0.00")
|
||||
find('.cart-price', text: "$ #{jamtrack_pearljam_evenflow.price}")
|
||||
find('.shopping-sub-total', text:"Subtotal:$ #{jamtrack_pearljam_evenflow.price}")
|
||||
|
||||
# attempt to checkout
|
||||
|
|
@ -1315,10 +1385,174 @@ describe "Checkout", :js => true, :type => :feature, :capybara_feature => true d
|
|||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be_false
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
user.purchased_jamtracks_count.should eq(3)
|
||||
end
|
||||
|
||||
it "user has both free and non-free jamtrack, all at once" do
|
||||
|
||||
jamtrack_led_zeppelin_kashmir.allow_free = false
|
||||
jamtrack_led_zeppelin_kashmir.save!
|
||||
jamtrack_acdc_backinblack.touch
|
||||
|
||||
|
||||
fast_signin(user, "/client?song=#{jamtrack_led_zeppelin_kashmir.name}#/jamtrack/search")
|
||||
find('h1', text: 'jamtracks')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_led_zeppelin_kashmir.id}\"]", text: 'ADD TO CART').trigger(:click)
|
||||
find('h1', text: 'shopping cart')
|
||||
sleep 2
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
|
||||
|
||||
find('h1', text: 'shopping cart')
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_led_zeppelin_kashmir.name}")
|
||||
find('.cart-price', text: "$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
find('.shopping-sub-total', text:"Subtotal:$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
|
||||
|
||||
go_to_root
|
||||
visit "/client#/jamtrack/search"
|
||||
find('#jamtrackSearch .Select-control').trigger(:mousedown)
|
||||
# wait for the 'Type to search' prompt to show
|
||||
find('#jamtrackSearch .Select-search-prompt')
|
||||
send_key_sequence('#jamtrackSearch .Select-control', '')
|
||||
find('#jamtrackSearch .search-btn').trigger(:click)
|
||||
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jamtrack_acdc_backinblack.id + '"]')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_acdc_backinblack.id}\"]", text: 'GET IT FREE!').trigger(:click)
|
||||
#find('.jam-tracks-in-browser')
|
||||
find('h1', text: 'shopping cart')
|
||||
sleep 2
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_acdc_backinblack.name}")
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_led_zeppelin_kashmir.name}")
|
||||
find('.cart-price', text: "$ 0.00")
|
||||
find('.cart-price', text: "$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
find('.shopping-sub-total', text:"Subtotal:$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
|
||||
# attempt to checkout
|
||||
find('a.button-orange', text: 'PROCEED TO CHECKOUT').trigger(:click)
|
||||
|
||||
# should be at payment page
|
||||
|
||||
# this should take us to the payment screen
|
||||
find('p.payment-prompt')
|
||||
|
||||
# fill out all billing info and account info
|
||||
fill_in 'billing-first-name', with: 'Seth'
|
||||
fill_in 'billing-last-name', with: 'Call'
|
||||
fill_in 'billing-address1', with: '10704 Buckthorn Drive'
|
||||
fill_in 'billing-city', with: 'Austin'
|
||||
fill_in 'billing-state', with: 'Texas'
|
||||
fill_in 'billing-zip', with: '78759'
|
||||
fill_in 'card-number', with: '4111111111111111'
|
||||
fill_in 'card-verify', with: '012'
|
||||
#jk_select('US', '#checkoutPaymentScreen #divBillingCountry #billing-country')
|
||||
|
||||
find('#payment-info-next').trigger(:click)
|
||||
|
||||
# should be taken straight to order page
|
||||
|
||||
# now see order page, and everything should no longer appear free
|
||||
find('p.order-prompt')
|
||||
find('.order-items-value.order-total', text:'$1.99')
|
||||
find('.order-items-value.shipping-handling', text:'$0.00')
|
||||
find('.order-items-value.sub-total', text:'$1.99')
|
||||
find('.order-items-value.taxes', text:'$0.16')
|
||||
find('.order-items-value.grand-total', text:'$2.15')
|
||||
|
||||
# click the ORDER button
|
||||
find('.place-order-center a.button-orange.place-order').trigger(:click)
|
||||
|
||||
# and now we should see confirmation, and a notice that we are in a normal browser
|
||||
find('.thanks-detail.jam-tracks-in-browser')
|
||||
|
||||
user.reload
|
||||
|
||||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be false
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
user.purchased_jamtracks_count.should eq(2)
|
||||
|
||||
|
||||
end
|
||||
|
||||
it "user has non-free jamtrack" do
|
||||
|
||||
jamtrack_led_zeppelin_kashmir.allow_free = false
|
||||
jamtrack_led_zeppelin_kashmir.save!
|
||||
jamtrack_acdc_backinblack.touch
|
||||
|
||||
|
||||
fast_signin(user, "/client?song=#{jamtrack_led_zeppelin_kashmir.name}#/jamtrack/search")
|
||||
find('h1', text: 'jamtracks')
|
||||
find("a.jamtrack-add-cart[data-jamtrack-id=\"#{jamtrack_led_zeppelin_kashmir.id}\"]", text: 'ADD TO CART').trigger(:click)
|
||||
find('h1', text: 'shopping cart')
|
||||
sleep 2
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
|
||||
|
||||
find('h1', text: 'shopping cart')
|
||||
find('.cart-item-caption', text: "JamTrack: #{jamtrack_led_zeppelin_kashmir.name}")
|
||||
find('.cart-price', text: "$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
find('.shopping-sub-total', text:"Subtotal:$ #{jamtrack_led_zeppelin_kashmir.price}")
|
||||
|
||||
|
||||
# attempt to checkout
|
||||
find('a.button-orange', text: 'PROCEED TO CHECKOUT').trigger(:click)
|
||||
|
||||
# should be at payment page
|
||||
|
||||
# this should take us to the payment screen
|
||||
find('p.payment-prompt')
|
||||
|
||||
# fill out all billing info and account info
|
||||
fill_in 'billing-first-name', with: 'Seth'
|
||||
fill_in 'billing-last-name', with: 'Call'
|
||||
fill_in 'billing-address1', with: '10704 Buckthorn Drive'
|
||||
fill_in 'billing-city', with: 'Austin'
|
||||
fill_in 'billing-state', with: 'Texas'
|
||||
fill_in 'billing-zip', with: '78759'
|
||||
fill_in 'card-number', with: '4111111111111111'
|
||||
fill_in 'card-verify', with: '012'
|
||||
#jk_select('US', '#checkoutPaymentScreen #divBillingCountry #billing-country')
|
||||
|
||||
find('#payment-info-next').trigger(:click)
|
||||
|
||||
# should be taken straight to order page
|
||||
|
||||
# now see order page, and everything should no longer appear free
|
||||
find('p.order-prompt')
|
||||
find('.order-items-value.order-total', text:'$1.99')
|
||||
find('.order-items-value.shipping-handling', text:'$0.00')
|
||||
find('.order-items-value.sub-total', text:'$1.99')
|
||||
find('.order-items-value.taxes', text:'$0.16')
|
||||
find('.order-items-value.grand-total', text:'$2.15')
|
||||
|
||||
# click the ORDER button
|
||||
find('.place-order-center a.button-orange.place-order').trigger(:click)
|
||||
|
||||
# and now we should see confirmation, and a notice that we are in a normal browser
|
||||
find('.thanks-detail.jam-tracks-in-browser')
|
||||
|
||||
user.reload
|
||||
|
||||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
user.purchased_jamtracks_count.should eq(1)
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ describe "Gift Card Landing", :js => true, :type => :feature, :capybara_feature
|
|||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
created_user.reload
|
||||
created_user.has_redeemable_jamtrack.should be_true
|
||||
created_user.has_redeemable_jamtrack.should be true
|
||||
created_user.gifted_jamtracks.should eq(0)
|
||||
created_user.gift_card_purchases.length.should eq(1)
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ describe "Gift Card Landing", :js => true, :type => :feature, :capybara_feature
|
|||
line_item.unit_price.should eq(10.00)
|
||||
line_item.sale.should eq(sale)
|
||||
line_item.affiliate_referral.should eq(partner)
|
||||
line_item.affiliate_refunded.should be_false
|
||||
line_item.affiliate_refunded.should be false
|
||||
line_item.affiliate_refunded_at.should be_nil
|
||||
line_item.affiliate_referral_fee_in_cents.should eq(10.00 * partner.rate * 100)
|
||||
end
|
||||
|
|
@ -191,7 +191,7 @@ describe "Gift Card Landing", :js => true, :type => :feature, :capybara_feature
|
|||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
created_user.reload
|
||||
created_user.has_redeemable_jamtrack.should be_true
|
||||
created_user.has_redeemable_jamtrack.should be true
|
||||
created_user.gifted_jamtracks.should eq(0)
|
||||
created_user.gift_card_purchases.length.should eq(1)
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ describe "Gift Card Landing", :js => true, :type => :feature, :capybara_feature
|
|||
sleep 3 # challenge to all comers! WHY DO I HAVE TO SLEEP FOR THIS ASSERTION TO BE TRUE! GAH . and 1 second won't do it
|
||||
|
||||
user.reload
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
user.gift_card_purchases.length.should eq(1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
let(:jamtrack_acdc_backinblack) { @jamtrack_acdc_backinblack }
|
||||
let(:jamtrack_not_free) {@jamtrack_not_free}
|
||||
|
||||
let(:billing_info) {
|
||||
{
|
||||
|
|
@ -34,6 +35,7 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
|
||||
before(:all) do
|
||||
@jamtrack_acdc_backinblack = FactoryGirl.create(:jam_track, name: 'Back in Black', original_artist: 'AC/DC', sales_region: 'United States', make_track: true, plan_code: 'jamtrack-acdc-backinblack')
|
||||
@jamtrack_not_free = FactoryGirl.create(:jam_track, price: 2.99, name: 'Not Free', original_artist: 'AC/DC', sales_region: 'United States', make_track: true, plan_code: 'jamtrack-not-free', allow_free: false)
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -42,8 +44,8 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
it "logged out" do
|
||||
visit "/landing/jamtracks/#{@jamtrack_acdc_backinblack.slug}"
|
||||
|
||||
find('h1.jam-track-name', jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
find('h1.jam-track-name', text: jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', text: "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
|
|
@ -83,11 +85,47 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
user.origin_referrer.should_not be_nil
|
||||
end
|
||||
|
||||
it "logged out on non-free JamTrack" do
|
||||
visit "/landing/jamtracks/#{jamtrack_not_free.slug}"
|
||||
|
||||
find('h1.jam-track-name', text: jamtrack_not_free.name.upcase)
|
||||
find('h2.original-artist', text: "by " + jamtrack_not_free.original_artist.upcase)
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:'Master Mix')
|
||||
else
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="' + track.instrument.id + '"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:track.instrument.description)
|
||||
end
|
||||
end
|
||||
find('a.browse-all')['href'].should include("/client?search=#/jamtrack/search")
|
||||
find('.price-advisory', text: '$2.99')
|
||||
find('button.cta-button', text: 'Add To Cart').trigger(:click)
|
||||
|
||||
# should fail because we haven't filled out email/password/terms
|
||||
find('.register-area .errors', text: "Email can't be blank")
|
||||
|
||||
fill_in "email", with: 'testuser_nonfree@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.terms-checkbox').trigger(:click)
|
||||
find('button.cta-button', text: 'Add To Cart').trigger(:click)
|
||||
|
||||
# should be in the shopping cart page
|
||||
find('h1', text: 'shopping cart')
|
||||
|
||||
user = User.find_by_email!("testuser_nonfree@jamkazam.com")
|
||||
user.origin_utm_source.should eql "organic"
|
||||
user.origin_utm_campaign.should eql "127.0.0.1"
|
||||
user.origin_utm_medium.should eql "organic"
|
||||
user.origin_referrer.should_not be_nil
|
||||
end
|
||||
|
||||
it "logged out with origin info" do
|
||||
visit "/landing/jamtracks/#{@jamtrack_acdc_backinblack.slug}?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
|
||||
|
||||
find('h1.jam-track-name', jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
find('h1.jam-track-name', text: jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', text: "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
|
|
@ -121,8 +159,8 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
it "logged in" do
|
||||
fast_signin(user, "/landing/jamtracks/#{@jamtrack_acdc_backinblack.slug}")
|
||||
|
||||
find('h1.jam-track-name', jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
find('h1.jam-track-name', text: jamtrack_acdc_backinblack.name.upcase)
|
||||
find('h2.original-artist', text: "by " + jamtrack_acdc_backinblack.original_artist.upcase)
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
|
|
@ -136,62 +174,5 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
find('.browse-jamtracks', text: 'search jamtracks')
|
||||
|
||||
end
|
||||
|
||||
it "generic version" do
|
||||
pending "no generic version at the moment"
|
||||
visit "/landing/jamtracks/acdc-backinblack?generic=true"
|
||||
|
||||
find('h1', "Backing Tracks + Free Amazing App = Unmatched Experience")
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:'Master Mix')
|
||||
else
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="' + track.instrument.id + '"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:track.instrument.description)
|
||||
end
|
||||
end
|
||||
find('a.cta-free-jamtrack').trigger(:click)
|
||||
find('h1', text: 'check out')
|
||||
find('h3', text: 'OR SIGN UP USING YOUR EMAIL')
|
||||
end
|
||||
|
||||
it "band version" do
|
||||
pending "no band version at the moment"
|
||||
visit "/landing/jamtracks/band/acdc-backinblack"
|
||||
|
||||
find('h1', "#{jamtrack_acdc_backinblack.original_artist} Backing Tracks - Complete Multitracks")
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:'Master Mix')
|
||||
else
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="' + track.instrument.id + '"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:track.instrument.description)
|
||||
end
|
||||
end
|
||||
find('a.cta-free-jamtrack').trigger(:click)
|
||||
find('h1', text: 'check out')
|
||||
find('h3', text: 'OR SIGN UP USING YOUR EMAIL')
|
||||
end
|
||||
|
||||
it "instrument version" do
|
||||
pending "no instrument version at the moment"
|
||||
visit "/landing/jamtracks/electric%20guitar/acdc-backinblack"
|
||||
|
||||
find('h1', "We Have 1 JamTracks With Electric Guitar Parts - Play Along With Your Favorites!")
|
||||
jamtrack_acdc_backinblack.jam_track_tracks.each do |track|
|
||||
if track.master?
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="other"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:'Master Mix')
|
||||
else
|
||||
find('.tracks.previews[data-id="' + track.id + '"] img.instrument-icon[data-instrument-id="' + track.instrument.id + '"]')
|
||||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:track.instrument.description)
|
||||
end
|
||||
end
|
||||
find('a.cta-free-jamtrack').trigger(:click)
|
||||
find('h1', text: 'check out')
|
||||
find('h3', text: 'OR SIGN UP USING YOUR EMAIL')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ require 'spec_helper'
|
|||
describe "JamTrack Search", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
let(:user) { FactoryGirl.create(:user, has_redeemable_jamtrack: true) }
|
||||
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'United States', make_track: true, original_artist: "foobar") }
|
||||
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
|
||||
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'United States', make_track: true, original_artist: "foobar", price:2.99) }
|
||||
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo", price:3.99, allow_free: false) }
|
||||
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'the live', genres: [JamRuby::Genre.find('rock')], make_track: true, original_artist: "the food") }
|
||||
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'live dog', genres: [JamRuby::Genre.find('blues')], make_track: true, original_artist: "food dog") }
|
||||
|
||||
|
|
@ -87,4 +87,31 @@ describe "JamTrack Search", :js => true, :type => :feature, :capybara_feature =>
|
|||
#jt_blues.touch
|
||||
|
||||
end
|
||||
|
||||
it "search with non-free and free jamtracks in the mix" do
|
||||
jt_us.touch
|
||||
jt_ww.touch
|
||||
|
||||
fast_signin user, "/client#/jamtrack/search"
|
||||
find('h1', text: 'search jamtracks')
|
||||
find('#jamtrackSearch .search-btn').trigger(:click)
|
||||
|
||||
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jt_us.id + '"]')
|
||||
|
||||
find('a.jamtrack-add-cart.is_free[data-jamtrack-id="' + jt_us.id + '"]', text: 'GET IT FREE!')
|
||||
find('.jamtrack-record[data-jamtrack-id="' + jt_ww.id + '"] .jamtrack-price.non-free', text: "$ #{jt_ww.price}")
|
||||
find('a.jamtrack-add-cart[data-jamtrack-id="' + jt_ww.id + '"]', text: 'ADD TO CART').trigger(:click)
|
||||
find('h1', text: 'shopping cart')
|
||||
|
||||
find('.cart-item-price', text: "$ #{jt_ww.price}")
|
||||
|
||||
find('a', text: 'CONTINUE SHOPPING').trigger(':click')
|
||||
|
||||
find('a.jamtrack-add-cart.is_free[data-jamtrack-id="' + jt_us.id + '"]', text: 'GET IT FREE!').trigger(:click)
|
||||
|
||||
find('.cart-item-price', text: "$ #{jt_us.price}")
|
||||
find('.cart-item-price', text: "$ #{jt_ww.price}")
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
it "shows Missed (Both)" do
|
||||
lesson = testdrive_lesson(user, teacher_user, {miss: true, accept: true})
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be_true
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be_true
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be true
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be true
|
||||
|
||||
fast_signin(user, "/client#/jamclass")
|
||||
|
||||
|
|
@ -20,8 +20,8 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
it "shows Missed (Student)" do
|
||||
lesson = testdrive_lesson(user, teacher_user, {accept: true, finish: true})
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be_false
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be_true
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be false
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be true
|
||||
|
||||
fast_signin(user, "/client#/jamclass")
|
||||
|
||||
|
|
@ -30,8 +30,8 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
it "shows Missed (Teacher)" do
|
||||
lesson = testdrive_lesson(user, teacher_user, {accept: true, teacher_miss: true})
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be_true
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be_false
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be true
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be false
|
||||
|
||||
fast_signin(user, "/client#/jamclass")
|
||||
|
||||
|
|
@ -43,8 +43,8 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
it "shows Completed" do
|
||||
lesson = testdrive_lesson(user, teacher_user, {accept: true, success: true})
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be_false
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be_false
|
||||
lesson.analysis_json["teacher_analysis"]["missed"].should be false
|
||||
lesson.analysis_json["student_analysis"]["missed"].should be false
|
||||
|
||||
fast_signin(user, "/client#/jamclass")
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
# don't cancel yet
|
||||
find('#banner .no-btn', text: 'CANCEL').trigger(:click)
|
||||
|
||||
lesson.teacher_unread_messages.should be_true
|
||||
lesson.teacher_unread_messages.should be true
|
||||
# also check that clicking messages icon shows view status screen (instead of chat dialog) # VRFS-4089
|
||||
find('tr[data-lesson-session-id="' + lesson.id + '"] td.unreadColumn a').trigger(:click)
|
||||
find('h2', text: 'respond to lesson request')
|
||||
|
|
@ -76,7 +76,7 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
switch_user(user, "/client#/jamclass")
|
||||
|
||||
lesson.reload
|
||||
lesson.student_unread_messages.should be_false
|
||||
lesson.student_unread_messages.should be false
|
||||
|
||||
find('#jam-class-student-screen td.displayStatusColumn', text: 'Requested')
|
||||
|
||||
|
|
@ -146,8 +146,8 @@ describe "JamClassScreen", :js => true, :type => :feature, :capybara_feature =>
|
|||
lesson = monthly_lesson(user, teacher_user, {accept: true})
|
||||
lesson1 = lesson.lesson_booking.lesson_sessions[0]
|
||||
lesson2 = lesson.lesson_booking.lesson_sessions[1]
|
||||
lesson1.recurring.should be_true
|
||||
lesson.lesson_booking.recurring.should be_true
|
||||
lesson1.recurring.should be true
|
||||
lesson.lesson_booking.recurring.should be true
|
||||
|
||||
fast_signin(user, "/client#/jamclass")
|
||||
find('tr[data-lesson-session-id="' + lesson1.id + '"] td.displayStatusColumn', text: 'Scheduled')
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
let(:user) { FactoryGirl.create(:user, gifted_jamtracks: 0, has_redeemable_jamtrack: false) }
|
||||
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'Worldwide', make_track: true, original_artist: "foobar") }
|
||||
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'Worldwide', make_track: true, original_artist: "foobar", price:2.99) }
|
||||
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
|
||||
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genres: [JamRuby::Genre.find('rock')], make_track: true, original_artist: "badfood") }
|
||||
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genres: [JamRuby::Genre.find('blues')], make_track: true, original_artist: "foodbart") }
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ describe "Lesson Booking Status page", :js => true, :type => :feature, :capybara
|
|||
Timecop.travel(lesson.scheduled_start + (lesson.duration * 60) + 1)
|
||||
|
||||
lesson.reload
|
||||
lesson.success.should be_true
|
||||
lesson.success.should be true
|
||||
lesson.status.should eql LessonSession::STATUS_COMPLETED
|
||||
|
||||
fast_signin(user, "/client#/jamclass/lesson-booking/" + lesson.id)
|
||||
|
|
@ -93,9 +93,9 @@ describe "Lesson Booking Status page", :js => true, :type => :feature, :capybara
|
|||
|
||||
lesson.reload
|
||||
lesson.status.should eql LessonSession::STATUS_COMPLETED
|
||||
lesson.success.should be_false
|
||||
lesson.student_missed.should be_true
|
||||
lesson.teacher_missed.should be_true
|
||||
lesson.success.should be false
|
||||
lesson.student_missed.should be true
|
||||
lesson.teacher_missed.should be true
|
||||
|
||||
fast_signin(user, "/client#/jamclass/lesson-booking/" + lesson.id)
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ describe "Lesson Booking Status page", :js => true, :type => :feature, :capybara
|
|||
# travel to after the lesson is over
|
||||
Timecop.travel(lesson.scheduled_start + (lesson.duration * 60) + 1)
|
||||
|
||||
lesson.success.should be_true
|
||||
lesson.success.should be true
|
||||
lesson.status.should eql LessonSession::STATUS_COMPLETED
|
||||
|
||||
fast_signin(teacher, "/client#/jamclass/lesson-booking/" + lesson.id)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
student.affiliate_referral.should eql school.affiliate_partner
|
||||
|
||||
school_invitation.reload
|
||||
school_invitation.accepted.should be_true
|
||||
school_invitation.accepted.should be true
|
||||
find('#user-profile #username', text: student.name)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ describe "Teacher Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
teacher.affiliate_referral.should eql school.affiliate_partner
|
||||
|
||||
school_invitation.reload
|
||||
school_invitation.accepted.should be_true
|
||||
school_invitation.accepted.should be true
|
||||
find('#user-profile #username', text: teacher.name)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
click_button "CREATE ACCOUNT"
|
||||
should have_title("JamKazam | Congratulations")
|
||||
should have_content("Congratulations! Your account is ready.")
|
||||
user = User.find_by_email('newuser1@jamkazam.com')
|
||||
user = User.find_by_email('withorigin1@jamkazam.com')
|
||||
user.musician_instruments.length.should == 1
|
||||
location = GeoIpLocations.lookup('127.0.0.1')
|
||||
user.country.should == location[:country]
|
||||
|
|
@ -85,7 +85,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
user.state.should == location[:state]
|
||||
user.city.should == location[:city]
|
||||
# an email is sent on no-invite signup
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries.length.should == 2
|
||||
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1
|
||||
uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
}
|
||||
|
|
@ -100,8 +100,6 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
it {
|
||||
should have_title("Signup Confirmation")
|
||||
should have_selector('h1', text: "Email Confirmed")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries[0].html_part.body.include?("Following are links to some resources") == 1
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -154,7 +152,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
it {
|
||||
should have_title("JamKazam")
|
||||
should have_selector('.flash-content', text: "Congratulations! Your account is ready.")
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries.length.should == 2
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
}
|
||||
|
|
@ -305,7 +303,7 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
User.find_by_email('newuser5@jamkazam.com').musician_instruments.length.should == 1
|
||||
User.find_by_email('what@jamkazam.com').should be_nil
|
||||
# an email is sent when you invite but use a different email than the one used to invite
|
||||
UserMailer.deliveries.length.should == 1
|
||||
UserMailer.deliveries.length.should == 2
|
||||
uri = URI.parse(current_url)
|
||||
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')
|
||||
sign_out
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
|
||||
purchase = user.most_recent_test_drive_purchase
|
||||
purchase.lesson_package_type.is_test_drive?.should be_true
|
||||
purchase.lesson_package_type.is_test_drive?.should be true
|
||||
purchase.lesson_package_type.test_drive_count.should eql 2
|
||||
|
||||
user.student_lesson_bookings.count.should eql 2
|
||||
|
|
@ -181,8 +181,8 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
foundTeacher2 = true
|
||||
end
|
||||
end
|
||||
foundTeacher1.should be_true
|
||||
foundTeacher2.should be_true
|
||||
foundTeacher1.should be true
|
||||
foundTeacher2.should be true
|
||||
end
|
||||
|
||||
it "2-count package, user picks 2" do
|
||||
|
|
@ -221,7 +221,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
|
||||
purchase = user.most_recent_test_drive_purchase
|
||||
purchase.lesson_package_type.is_test_drive?.should be_true
|
||||
purchase.lesson_package_type.is_test_drive?.should be true
|
||||
purchase.lesson_package_type.test_drive_count.should eql 2
|
||||
|
||||
user.student_lesson_bookings.count.should eql 2
|
||||
|
|
@ -235,8 +235,8 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
foundTeacher2 = true
|
||||
end
|
||||
end
|
||||
foundTeacher1.should be_true
|
||||
foundTeacher2.should be_true
|
||||
foundTeacher1.should be true
|
||||
foundTeacher2.should be true
|
||||
end
|
||||
|
||||
it "2-count package, user picks 1" do
|
||||
|
|
@ -278,7 +278,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
|
||||
|
||||
purchase = user.most_recent_test_drive_purchase
|
||||
purchase.lesson_package_type.is_test_drive?.should be_true
|
||||
purchase.lesson_package_type.is_test_drive?.should be true
|
||||
purchase.lesson_package_type.test_drive_count.should eql 1
|
||||
|
||||
user.student_lesson_bookings.count.should eql 1
|
||||
|
|
@ -288,7 +288,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
foundTeacher2 = true
|
||||
end
|
||||
end
|
||||
foundTeacher2.should be_true
|
||||
foundTeacher2.should be true
|
||||
end
|
||||
|
||||
it "1-count package" do
|
||||
|
|
@ -323,7 +323,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
choice.test_drive_package_choice_teachers.count.should eql 1
|
||||
|
||||
purchase = user.most_recent_test_drive_purchase
|
||||
purchase.lesson_package_type.is_test_drive?.should be_true
|
||||
purchase.lesson_package_type.is_test_drive?.should be true
|
||||
purchase.lesson_package_type.test_drive_count.should eql 1
|
||||
|
||||
user.student_lesson_bookings.count.should eql 1
|
||||
|
|
@ -333,7 +333,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
foundTeacher1 = true
|
||||
end
|
||||
end
|
||||
foundTeacher1.should be_true
|
||||
foundTeacher1.should be true
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
user.student_lesson_bookings.each do |booking|
|
||||
lesson = booking.lesson_sessions[0]
|
||||
lesson.status.should eql LessonSession::STATUS_REQUESTED
|
||||
booking.card_presumed_ok.should be_true
|
||||
booking.card_presumed_ok.should be true
|
||||
find('tr[data-lesson-session-id="' + lesson.id + '"] td.startTimeColumn', text: 'No time has been scheduled yet')
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ describe UserManager do
|
|||
musician: true,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 2
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
user.name.should eq 'Anonymous'
|
||||
end
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ describe UserManager do
|
|||
musician: true,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
user = @user_manager.signup_confirm(user.signup_token)
|
||||
user.email_confirmed.should be_true
|
||||
user.email_confirmed.should be true
|
||||
end
|
||||
|
||||
it "fail to confirm bogus signup_confirmnup token" do
|
||||
|
|
@ -722,12 +722,12 @@ describe UserManager do
|
|||
student: true,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 2
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
user = User.find(user.id)
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.is_a_student.should be_true
|
||||
user.is_a_teacher.should be_false
|
||||
user.musician.should be_true
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.is_a_student.should be true
|
||||
user.is_a_teacher.should be false
|
||||
user.musician.should be true
|
||||
end
|
||||
|
||||
it "accepts teacher" do
|
||||
|
|
@ -743,12 +743,12 @@ describe UserManager do
|
|||
teacher: true,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 2
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
user = User.find(user.id)
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.is_a_student.should be_false
|
||||
user.is_a_teacher.should be_true
|
||||
user.musician.should be_true
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.is_a_student.should be false
|
||||
user.is_a_teacher.should be true
|
||||
user.musician.should be true
|
||||
end
|
||||
|
||||
it "accepts teacher and student" do
|
||||
|
|
@ -764,12 +764,12 @@ describe UserManager do
|
|||
teacher: true,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 2
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
user = User.find(user.id)
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.is_a_student.should be_false
|
||||
user.is_a_teacher.should be_true
|
||||
user.musician.should be_true
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.is_a_student.should be false
|
||||
user.is_a_teacher.should be true
|
||||
user.musician.should be true
|
||||
end
|
||||
|
||||
it "lets user be a fan if nothing if musician/student/teacher is true" do
|
||||
|
|
@ -783,12 +783,12 @@ describe UserManager do
|
|||
location: @loca,
|
||||
signup_confirm_url: "http://localhost:3000/confirm")
|
||||
UserMailer.deliveries.length.should == 2
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
user = User.find(user.id)
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.is_a_student.should be_false
|
||||
user.is_a_teacher.should be_false
|
||||
user.musician.should be_false
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.is_a_student.should be false
|
||||
user.is_a_teacher.should be false
|
||||
user.musician.should be false
|
||||
end
|
||||
end
|
||||
describe "gift_card" do
|
||||
|
|
@ -808,11 +808,11 @@ describe UserManager do
|
|||
location: @loca,
|
||||
signup_confirm_url: "http://localhost:3000/confirm",
|
||||
gift_card: gift_card.code)
|
||||
user.errors.any?.should be_false
|
||||
user.errors.any?.should be false
|
||||
gift_card.reload
|
||||
gift_card.user.should eq(user)
|
||||
user = User.find(user.id)
|
||||
user.has_redeemable_jamtrack.should be_true
|
||||
user.has_redeemable_jamtrack.should be true
|
||||
user.gifted_jamtracks.should eq(5)
|
||||
user.gift_cards[0].should eq(gift_card)
|
||||
end
|
||||
|
|
@ -830,7 +830,7 @@ describe UserManager do
|
|||
location: @loca,
|
||||
signup_confirm_url: "http://localhost:3000/confirm",
|
||||
gift_card: '')
|
||||
user.errors.any?.should be_true
|
||||
user.errors.any?.should be true
|
||||
user.errors["gift_card"].should eq(["not found"])
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
gift_card.reload
|
||||
|
|
@ -854,7 +854,7 @@ describe UserManager do
|
|||
location: @loca,
|
||||
signup_confirm_url: "http://localhost:3000/confirm",
|
||||
gift_card: '')
|
||||
user.errors.any?.should be_true
|
||||
user.errors.any?.should be true
|
||||
user.errors["gift_card"].should eq(["not found"])
|
||||
user.gifted_jamtracks.should eq(0)
|
||||
gift_card.reload
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe UsersController, :type => :request do
|
||||
describe UsersController, :type => :api do
|
||||
#render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
@ -8,8 +8,19 @@ describe UsersController, :type => :request do
|
|||
let(:utm_valid_cookie) { {"utm_source" => "abcya", "utm_medium" => "browser", "utm_campaign" => "dog", "referrer" => nil} }
|
||||
|
||||
before(:each) {
|
||||
controller.current_user = nil
|
||||
#controller.current_user = nil
|
||||
#login(authenticated_user.email, authenticated_user.password, 200, true)
|
||||
}
|
||||
|
||||
it "unsubscribe" do
|
||||
user.subscribe_email.should eql true
|
||||
get '/unsubscribe/' + user.unsubscribe_token
|
||||
|
||||
last_response.body.should eql ('You have been unsubscribed.')
|
||||
user.reload
|
||||
user.subscribe_email.should eql false
|
||||
end
|
||||
|
||||
describe "track_origin" do
|
||||
describe "logged out" do
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ bputs "before load capybara"
|
|||
bputs "before load poltergeist"
|
||||
require 'capybara/poltergeist'
|
||||
bputs "before register capybara"
|
||||
Capybara::Screenshot::RSpec.add_link_to_screenshot_for_failed_examples = true
|
||||
Capybara::Screenshot.prune_strategy = :keep_last_run
|
||||
Capybara.register_driver :poltergeist do |app|
|
||||
# '--load-images=no'
|
||||
driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w'), phantomjs_options: ['--ignore-ssl-errors=yes'] })
|
||||
|
|
@ -204,6 +206,8 @@ bputs "before register capybara"
|
|||
tests_started = true
|
||||
end
|
||||
|
||||
config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
|
||||
|
||||
config.before(:all) do
|
||||
# to reduce frequency of timeout on initial test
|
||||
# https://github.com/teampoltergeist/poltergeist/issues/294#issuecomment-72746472
|
||||
|
|
@ -256,7 +260,8 @@ bputs "before register capybara"
|
|||
end
|
||||
|
||||
config.after(:suite) do
|
||||
wipe_s3_test_bucket
|
||||
puts "S3 Bucket cleanup disabled"
|
||||
#wipe_s3_test_bucket
|
||||
end
|
||||
end
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -166,13 +166,13 @@ def book_lesson(user, teacher, options)
|
|||
end
|
||||
|
||||
|
||||
booking.errors.any?.should be_false unless options[:no_validate]
|
||||
booking.errors.any?.should be false unless options[:no_validate]
|
||||
|
||||
lesson = booking.lesson_sessions[0]
|
||||
start = lesson.scheduled_start
|
||||
end_time = lesson.scheduled_start + (60 * lesson.duration)
|
||||
|
||||
booking.card_presumed_ok.should be_true unless options[:no_validate]
|
||||
booking.card_presumed_ok.should be true unless options[:no_validate]
|
||||
|
||||
if options[:test_drive]
|
||||
if user.most_recent_test_drive_purchase.nil?
|
||||
|
|
@ -194,7 +194,7 @@ def book_lesson(user, teacher, options)
|
|||
|
||||
if options[:accept]
|
||||
lesson.accept({message: 'Yeah I got this', slot: slots[0].id, accepter: teacher})
|
||||
lesson.errors.any?.should be_false unless options[:no_validate]
|
||||
lesson.errors.any?.should be false unless options[:no_validate]
|
||||
lesson.reload
|
||||
lesson.slot.should eql slots[0] unless options[:no_validate]
|
||||
lesson.status.should eql LessonSession::STATUS_APPROVED unless options[:no_validate]
|
||||
|
|
|
|||
|
|
@ -228,16 +228,16 @@ def should_be_at_root(options={signed_in:nil})
|
|||
when Capybara::Poltergeist::Driver
|
||||
signed_in = !page.driver.cookies['remember_token'].nil?
|
||||
if signed_in
|
||||
find('h2', text: 'create session')
|
||||
find('h2', text: 'jamtracks')
|
||||
else
|
||||
find('h1', text: 'Live music platform & social network for musicians')
|
||||
find('a.join-today', text: 'JOIN TODAY, PLAY FREE!')
|
||||
end
|
||||
when Capybara::RackTest::Driver
|
||||
signed_in = !cookie_jar['remember_token'].nil?
|
||||
if signed_in
|
||||
find('h2', text: 'create session')
|
||||
find('h2', text: 'jamtracks')
|
||||
else
|
||||
find('h1', text: 'Live music platform & social network for musicians')
|
||||
find('a.join-today', text: 'JOIN TODAY, PLAY FREE!')
|
||||
end
|
||||
else
|
||||
raise "no cookie-setter implemented for driver #{Capybara.current_session.driver.class.name}"
|
||||
|
|
@ -439,7 +439,7 @@ def schedule_session(options = {})
|
|||
page.driver.resize(1500, 800) # makes sure all the elements are visible
|
||||
emulate_client
|
||||
fast_signin(creator, "/client#/createSession")
|
||||
expect(page).to have_selector('h1', text: 'create session')
|
||||
expect(page).to have_selector('h1', text: 'sessions')
|
||||
|
||||
within('#create-session-form') do
|
||||
if rsvp
|
||||
|
|
|
|||
Loading…
Reference in New Issue