user origin tracking VRFS-4072
This commit is contained in:
parent
a3c4b12b50
commit
e2073b49b9
|
|
@ -350,4 +350,5 @@ update_payment_history.sql
|
|||
lesson_booking_schools.sql
|
||||
lesson_booking_schools_2.sql
|
||||
phantom_accounts.sql
|
||||
lesson_booking_success.sql
|
||||
lesson_booking_success.sql
|
||||
user_origin.sql
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE users ADD COLUMN origin_utm_source VARCHAR DEFAULT 'legacy';
|
||||
ALTER TABLE users ADD COLUMN origin_utm_medium VARCHAR;
|
||||
ALTER TABLE users ADD COLUMN origin_utm_campaign VARCHAR;
|
||||
ALTER TABLE users ADD COLUMN origin_referrer VARCHAR;
|
||||
|
|
@ -513,7 +513,7 @@ module JamRuby
|
|||
# we are in the month being billed. we should set the start date based on today
|
||||
start_date = today
|
||||
end
|
||||
LessonSessionMonthlyPrice.price(self, start_date) * 100
|
||||
(LessonSessionMonthlyPrice.price(self, start_date) * 100).round
|
||||
else
|
||||
booked_price * 100
|
||||
end
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ module JamRuby
|
|||
def self.analyse_sessions
|
||||
MusicSession.joins(lesson_session: :lesson_booking).where('lesson_sessions.status = ?', LessonSession::STATUS_APPROVED).where("session_removed_at IS NOT NULL OR NOW() > scheduled_start + (INTERVAL '1 minutes' * duration)").where('analysed = false').each do |music_session|
|
||||
lession_session = music_session.lesson_session
|
||||
@@log.debug("analysis lesson session #{lession_session.id}")
|
||||
lession_session.analyse
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1105,6 +1105,7 @@ module JamRuby
|
|||
school_invitation_code = options[:school_invitation_code]
|
||||
school_id = options[:school_id]
|
||||
school_interest = options[:school_interest]
|
||||
origin = options[:origin]
|
||||
|
||||
school = School.find(school_id) if school_id
|
||||
user = User.new
|
||||
|
|
@ -1137,6 +1138,19 @@ module JamRuby
|
|||
end
|
||||
user.musician = !!musician
|
||||
|
||||
if origin
|
||||
user.origin_utm_source = origin["utm_source"]
|
||||
user.origin_utm_medium = origin["utm_medium"]
|
||||
user.origin_utm_campaign = origin["utm_campaign"]
|
||||
user.origin_referrer = origin["referrer"]
|
||||
else
|
||||
user.origin_utm_source = 'organic'
|
||||
user.origin_utm_medium = 'organic'
|
||||
user.origin_utm_campaign = nil
|
||||
user.origin_referrer = nil
|
||||
end
|
||||
|
||||
|
||||
if school_id.present?
|
||||
if user.is_a_student
|
||||
user.school_id = school_id
|
||||
|
|
|
|||
|
|
@ -1026,6 +1026,7 @@ FactoryGirl.define do
|
|||
association :teacher, factory: :teacher_user
|
||||
association :teacher_payment_charge, factory: :teacher_payment_charge
|
||||
amount_in_cents 1000
|
||||
fee_in_cents 0
|
||||
end
|
||||
|
||||
# you gotta pass either lesson_session or lesson_package_purchase for this to make sense
|
||||
|
|
|
|||
|
|
@ -379,9 +379,9 @@ describe LessonBooking do
|
|||
# but don't run the computation of times per month for weeks
|
||||
Timecop.freeze(Date.new(next_year, 1, 23))
|
||||
times = booking.predicted_times_for_month(next_year, 1)
|
||||
times.length.should eql 2
|
||||
times[0].to_date.should eql (Date.new(next_year, 1, 1))
|
||||
times[1].to_date.should eql (Date.new(next_year, 1, 29))
|
||||
times[:times].length.should eql 2
|
||||
times[:times][0].to_date.should eql (Date.new(next_year, 1, 1))
|
||||
times[:times][1].to_date.should eql (Date.new(next_year, 1, 29))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ describe LessonBooking do
|
|||
|
||||
booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, "Hey I've heard of you before.")
|
||||
booking.errors.any?.should be true
|
||||
booking.errors[:user].should eq ["have a requested TestDrive with this teacher"]
|
||||
booking.errors[:user].should eq ["have an in-progress or successful TestDrive with this teacher already"]
|
||||
|
||||
ChatMessage.count.should eq 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ describe LessonSession do
|
|||
lesson.accept({
|
||||
message: "Teacher time!",
|
||||
acceptor: teacher,
|
||||
slot: slot
|
||||
slot: slotRecurring1
|
||||
})
|
||||
lesson.errors.any?.should be_true
|
||||
lesson.errors[:slot].should eql ["is in the past"]
|
||||
|
|
|
|||
|
|
@ -811,6 +811,9 @@ describe User do
|
|||
it "works" do
|
||||
user.has_rated_teacher(teacher).should eql false
|
||||
review = Review.create(target:teacher, rating:3, user: user)
|
||||
review.errors[:target].should eql ["You must have at least scheduled or been in a lesson with this teacher"]
|
||||
normal_lesson(user, teacher.user)
|
||||
review = Review.create(target:teacher, rating:3, user: user)
|
||||
review.errors.any?.should be false
|
||||
user.has_rated_teacher(teacher).should be true
|
||||
end
|
||||
|
|
@ -865,12 +868,14 @@ describe User do
|
|||
end
|
||||
|
||||
it "for monthly" do
|
||||
Timecop.travel(Date.new(2016,1,1))
|
||||
lesson_session = monthly_lesson(user, teacher)
|
||||
lesson_session.booked_price.should eql 30.00
|
||||
LessonBooking.hourly_check
|
||||
lesson_session.lesson_payment_charge.should be_nil
|
||||
purchases=LessonPackagePurchase.where(user_id: user.id)
|
||||
purchases.count.should eql 1
|
||||
purchases[0].lesson_payment_charge.billed = false
|
||||
purchases[0].lesson_payment_charge.billing_attempts = 1
|
||||
purchases[0].lesson_payment_charge.save!
|
||||
uncollectables = user.uncollectables
|
||||
|
|
@ -880,6 +885,25 @@ describe User do
|
|||
uncollectable.expected_price_in_cents.should eql 3000
|
||||
uncollectable.is_card_declined?.should be_false
|
||||
end
|
||||
|
||||
it "for monthly near end of month" do
|
||||
Timecop.travel(Date.new(2016,5,23))
|
||||
lesson_session = monthly_lesson(user, teacher)
|
||||
lesson_session.booked_price.should eql 30.00
|
||||
LessonBooking.hourly_check
|
||||
lesson_session.lesson_payment_charge.should be_nil
|
||||
purchases=LessonPackagePurchase.where(user_id: user.id)
|
||||
purchases.count.should eql 1
|
||||
purchases[0].lesson_payment_charge.billed = false
|
||||
purchases[0].lesson_payment_charge.billing_attempts = 1
|
||||
purchases[0].lesson_payment_charge.save!
|
||||
uncollectables = user.uncollectables
|
||||
uncollectables.count.should eql 1
|
||||
uncollectable = uncollectables[0]
|
||||
uncollectable.description.should_not be_nil
|
||||
uncollectable.expected_price_in_cents.should eql 750
|
||||
uncollectable.is_card_declined?.should be_false
|
||||
end
|
||||
end
|
||||
=begin
|
||||
describe "update avatar" do
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ Stripe.api_key = "sk_test_OkjoIF7FmdjunyNsdVqJD02D"
|
|||
end
|
||||
|
||||
config.after(:each) do
|
||||
Timecop.return
|
||||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ class ApiRecurlyController < ApiController
|
|||
terms_of_service: terms_of_service,
|
||||
location: {:country => billing_info[:country], :state => billing_info[:state], :city => billing_info[:city]},
|
||||
reuse_card: reuse_card_next_time,
|
||||
affiliate_referral_id: cookies[:affiliate_visitor]
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ class ApiUsersController < ApiController
|
|||
school_invitation_code: params[:school_invitation_code],
|
||||
school_id: params[:school_id],
|
||||
school_interest: params[:school_interest],
|
||||
affiliate_referral_id: cookies[:affiliate_visitor]
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
before_filter :set_tracking_cookie
|
||||
before_filter :track_affiliate_visits
|
||||
before_filter :track_origin
|
||||
|
||||
before_filter do
|
||||
if params[AffiliatePartner::PARAM_REFERRAL].present? && current_user.nil?
|
||||
|
|
@ -46,6 +47,37 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def origin_cookie
|
||||
begin
|
||||
JSON.parse(cookies[:origin]) if cookies[:origin]
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def track_origin
|
||||
return if current_user
|
||||
|
||||
origin = cookies[:origin]
|
||||
|
||||
# if this is a 1st visit, or if we previously said this was a direct link, then we'll refresh the info
|
||||
should_set = params[:utm_source] || origin.nil?
|
||||
if should_set
|
||||
if params[:utm_source]
|
||||
cookies.permanent[:origin] = {utm_source: params[:utm_source], utm_medium: params[:utm_medium], utm_campaign: params[:utm_campaign], referrer: request.referrer }.to_json
|
||||
|
||||
elsif request.referer
|
||||
|
||||
begin
|
||||
cookies.permanent[:origin] = {utm_source: "organic", utm_medium: "organic", utm_campaign: URI.parse(request.referer).host, referrer: request.referer}.to_json
|
||||
rescue
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def add_user_info_to_bugsnag(notif)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ class SessionsController < ApplicationController
|
|||
email: email,
|
||||
terms_of_service: true,
|
||||
location: {:country => nil, :state => nil, :city => nil},
|
||||
affiliate_referral_id: cookies[:affiliate_visitor]
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class UsersController < ApplicationController
|
|||
fb_signup: @fb_signup,
|
||||
signup_confirm_url: ApplicationHelper.base_uri(request) + "/confirm",
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
affiliate_partner: @affiliate_partner)
|
||||
affiliate_partner: @affiliate_partner,
|
||||
origin: origin_cookie)
|
||||
|
||||
# check for errors
|
||||
if @user.errors.any?
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class UserManager < BaseManager
|
|||
school_invitation_code = options[:school_invitation_code]
|
||||
school_id = options[:school_id]
|
||||
school_interest = options[:school_interest]
|
||||
origin = options[:origin]
|
||||
|
||||
recaptcha_failed = false
|
||||
unless options[:skip_recaptcha] # allow callers to opt-of recaptcha
|
||||
|
|
@ -84,7 +85,8 @@ class UserManager < BaseManager
|
|||
teacher: teacher,
|
||||
school_invitation_code: school_invitation_code,
|
||||
school_id: school_id,
|
||||
school_interest: school_interest)
|
||||
school_interest: school_interest,
|
||||
origin: origin)
|
||||
user
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe UsersController, :type => :request do
|
||||
render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
let(:utm_valid_url) { '/?utm_source=abcya&utm_medium=browsers&utm_campaign=dog' }
|
||||
let(:utm_valid_cookie) { {"utm_source" => "abcya", "utm_medium" => "browser", "utm_campaign" => "dog", "referrer" => nil} }
|
||||
|
||||
before(:each) {
|
||||
controller.current_user = nil
|
||||
}
|
||||
describe "track_origin" do
|
||||
describe "logged out" do
|
||||
|
||||
it "should not distrib origin if already set and no utm_source" do
|
||||
|
||||
weird_origin = {"something" => "nothing"}
|
||||
cookie_jar[:origin] = weird_origin.to_json
|
||||
request.cookies[:origin] = weird_origin.to_json
|
||||
|
||||
get :home
|
||||
response.cookies["origin"].should be_nil
|
||||
end
|
||||
|
||||
it "should overwrite origin if already set and URL has utm_source" do
|
||||
weird_origin = {"utm_source" => "nothing"}
|
||||
request.cookies[:origin] = weird_origin
|
||||
get :home, utm_valid_cookie
|
||||
JSON.parse(response.cookies["origin"]).should eql utm_valid_cookie
|
||||
end
|
||||
|
||||
it "should set origin to organic if referrer set" do
|
||||
controller.request.stub referer: 'http://somewhere.com/ha'
|
||||
get :home
|
||||
JSON.parse(response.cookies["origin"]).should eql ({"utm_source" => "organic", "utm_medium" => "organic", "utm_campaign" => "somewhere.com", "referrer" => 'http://somewhere.com/ha'})
|
||||
end
|
||||
|
||||
it "should ignore referrer if origin already set" do
|
||||
weird_origin = {"utm_source" => "nothing"}
|
||||
request.cookies[:origin] = weird_origin
|
||||
get :home, utm_valid_cookie
|
||||
JSON.parse(response.cookies["origin"]).should eql utm_valid_cookie
|
||||
|
||||
controller.request.stub referer: 'http://somewhere.com/ha'
|
||||
get :home
|
||||
response.cookies["origin"].should be_nil
|
||||
end
|
||||
|
||||
it "should not set origin with no referrer info" do
|
||||
get :home
|
||||
|
||||
response.cookies["origin"].should be_nil
|
||||
end
|
||||
|
||||
it "should set origin with referrer info" do
|
||||
get :home, utm_valid_cookie
|
||||
JSON.parse(response.cookies["origin"]).should eql utm_valid_cookie
|
||||
end
|
||||
end
|
||||
|
||||
describe "logged in" do
|
||||
|
||||
it "should not set origin with no referrer info" do
|
||||
controller.current_user = user
|
||||
get :home
|
||||
response.cookies["origin"].should be_nil
|
||||
end
|
||||
|
||||
it "should not set origin with referrer info" do
|
||||
controller.current_user = user
|
||||
get :home, utm_valid_cookie
|
||||
response.cookies["origin"].should be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -994,6 +994,7 @@ FactoryGirl.define do
|
|||
association :teacher, factory: :teacher_user
|
||||
association :teacher_payment_charge, factory: :teacher_payment_charge
|
||||
amount_in_cents 1000
|
||||
fee_in_cents 0
|
||||
end
|
||||
|
||||
# you gotta pass either lesson_session or lesson_package_purchase for this to make sense
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
find('.tracks.previews[data-id="' + track.id + '"] .instrument-name', text:track.instrument.description)
|
||||
end
|
||||
end
|
||||
find('a.browse-all')['href'].should eq("/client?search=#/jamtrack/search")
|
||||
find('a.browse-all')['href'].should include("/client?search=#/jamtrack/search")
|
||||
find('button.cta-button', text: 'GET IT FREE!').trigger(:click)
|
||||
|
||||
# should fail because we haven't filled out email/password/terms
|
||||
|
|
@ -61,7 +61,7 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
|
||||
fill_in "email", with: 'testuser_123@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.register-area ins').trigger(:click)
|
||||
find('.terms-checkbox').trigger(:click)
|
||||
find('button.cta-button', text: 'GET IT FREE!').trigger(:click)
|
||||
|
||||
# this should show on the /client#/jamtrack page
|
||||
|
|
@ -73,11 +73,49 @@ describe "Individual JamTrack", :js => true, :type => :feature, :capybara_featur
|
|||
visit "/landing/jamtracks/#{@jamtrack_acdc_backinblack.slug}"
|
||||
find('button.cta-button', text: 'Add To Cart')
|
||||
find('.price-advisory', text:"$1.99")
|
||||
find('a.cta-free-jamtrack').trigger(:click)
|
||||
find('h1', text: 'check out')
|
||||
find('button.cta-button').trigger(:click)
|
||||
find('h1', text: 'shopping cart')
|
||||
|
||||
user = User.find_by_email!("testuser_123@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)
|
||||
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('button.cta-button', text: 'GET IT FREE!').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_123_o@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.terms-checkbox').trigger(:click)
|
||||
find('button.cta-button', text: 'GET IT FREE!').trigger(:click)
|
||||
|
||||
# this should show on the /client#/jamtrack page
|
||||
find('.no-free-jamtrack')
|
||||
|
||||
user = User.find_by_email!("testuser_123_o@jamkazam.com")
|
||||
user.origin_utm_source.should eql "abc"
|
||||
user.origin_utm_campaign.should eql "campaign1"
|
||||
user.origin_utm_medium.should eql "ads"
|
||||
user.origin_referrer.should be_nil
|
||||
end
|
||||
|
||||
it "logged in" do
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
student.teacher.should be_nil
|
||||
student.school.should eql school
|
||||
student.affiliate_referral.should eql school.affiliate_partner
|
||||
|
||||
student.origin_utm_source.should eql "organic"
|
||||
student.origin_utm_campaign.should eql "127.0.0.1"
|
||||
student.origin_utm_medium.should eql "organic"
|
||||
student.origin_referrer.should_not be_nil
|
||||
find('#user-profile #username', text: student.name)
|
||||
|
||||
UserMailer.deliveries.count.should eql 2
|
||||
|
|
@ -117,4 +120,43 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
#user.musician.should be true
|
||||
end
|
||||
|
||||
it "user origin" do
|
||||
|
||||
visit "/school/#{school.id}/student?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
|
||||
|
||||
find('.header-content h1', 'REGISTER AS STUDENT')
|
||||
find('.header-content h2', "with #{school.name}")
|
||||
|
||||
find('button.cta-button', text: 'SIGN UP').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: 'school_student_125@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.register-area ins', visible: false).trigger(:click)
|
||||
find('button.cta-button', text: 'SIGN UP').trigger(:click)
|
||||
|
||||
#find('h2', text: 'my lessons')
|
||||
find('#type-label', text: 'musician')
|
||||
|
||||
|
||||
student = User.find_by_email('school_student_125@jamkazam.com')
|
||||
student.is_a_student.should be true
|
||||
student.is_a_teacher.should be false
|
||||
student.musician.should be true
|
||||
student.teacher.should be_nil
|
||||
student.school.should eql school
|
||||
student.origin_utm_source.should eql "abc"
|
||||
student.origin_utm_campaign.should eql "campaign1"
|
||||
student.origin_utm_medium.should eql "ads"
|
||||
student.origin_referrer.should be_nil
|
||||
student.affiliate_referral.should eql school.affiliate_partner
|
||||
|
||||
find('#user-profile #username', text: student.name)
|
||||
|
||||
UserMailer.deliveries.count.should eql 2
|
||||
UserMailer.deliveries[0].html_part.body.include?("If you already know the teacher from whom you want to learn") == 1
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,6 +19,34 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
|
|||
MaxMindManager.create_phony_database
|
||||
end
|
||||
|
||||
describe "with origin" do
|
||||
|
||||
# Successful signup with no invitation tells you to go sign up
|
||||
it {
|
||||
visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
|
||||
fill_in "jam_ruby_user[first_name]", with: "Mike"
|
||||
fill_in "jam_ruby_user[last_name]", with: "Jones"
|
||||
fill_in "jam_ruby_user[email]", with: "withorigin1@jamkazam.com"
|
||||
fill_in "jam_ruby_user[password]", with: "jam123"
|
||||
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
|
||||
check("jam_ruby_user[instruments][drums][selected]")
|
||||
check("jam_ruby_user[terms_of_service]")
|
||||
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.musician_instruments.length.should == 1
|
||||
location = GeoIpLocations.lookup('127.0.0.1')
|
||||
user.country.should == location[:country]
|
||||
user.state.should == location[:state]
|
||||
user.city.should == location[:city]
|
||||
# an email is sent on no-invite signup
|
||||
user.origin_utm_source.should eql 'abc'
|
||||
user.origin_utm_campaign.should eql 'campaign1'
|
||||
user.origin_utm_medium.should eql 'ads'
|
||||
user.origin_referrer.should be_nil
|
||||
}
|
||||
end
|
||||
describe "signup page" do
|
||||
before { visit signup_path }
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
it "logged out" do
|
||||
visit "/landing/jamclass/students"
|
||||
|
||||
find('h1.jam-track-name', 'JAMCLASS')
|
||||
find('h2.original-artist', 'Finally, online music lessons that really work!')
|
||||
find('h1.jamclass-h1', 'Let Us Find You The Perfect Music Teacher')
|
||||
find('h2.jamclass-h2', 'And Connect You Online With Our Patented, Unique Technology')
|
||||
|
||||
find('button.cta-button', text: 'SIGN UP').trigger(:click)
|
||||
|
||||
|
|
@ -39,13 +39,47 @@ describe "Student Landing", :js => true, :type => :feature, :capybara_feature =>
|
|||
user.is_a_student.should be true
|
||||
user.is_a_teacher.should be false
|
||||
user.musician.should be true
|
||||
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/jamclass/students?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
|
||||
|
||||
find('h1.jamclass-h1', 'Let Us Find You The Perfect Music Teacher')
|
||||
find('h2.jamclass-h2', 'And Connect You Online With Our Patented, Unique Technology')
|
||||
|
||||
find('button.cta-button', text: 'SIGN UP').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: 'student_125@jamkazam.com'
|
||||
fill_in "password", with: 'jam123'
|
||||
find('.register-area ins', visible: false) .trigger(:click)
|
||||
find('button.cta-button', text: 'SIGN UP').trigger(:click)
|
||||
|
||||
# this should show on the /client#/home page (WILL CHANGE)
|
||||
find('h1', text: 'musician profile')
|
||||
|
||||
user = User.find_by_email('student_125@jamkazam.com')
|
||||
user.is_a_student.should be true
|
||||
user.is_a_teacher.should be false
|
||||
user.musician.should be true
|
||||
user.origin_utm_source.should eql "abc"
|
||||
user.origin_utm_campaign.should eql "campaign1"
|
||||
user.origin_utm_medium.should eql "ads"
|
||||
user.origin_referrer.should be_nil
|
||||
end
|
||||
|
||||
|
||||
it "logged in" do
|
||||
fast_signin(user,"/landing/jamclass/students")
|
||||
|
||||
find('h1.jam-track-name', 'JAMCLASS')
|
||||
find('h2.original-artist', 'Finally, online music lessons that really work!')
|
||||
find('h1.jamclass-h1', 'Let Us Find You The Perfect Music Teacher')
|
||||
find('h2.jamclass-h2', 'And Connect You Online With Our Patented, Unique Technology')
|
||||
|
||||
find('button.cta-button', text: 'TRY TESTDRIVE').trigger(:click)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue