jam-cloud/web/spec/features/student_landing_spec.rb

96 lines
3.1 KiB
Ruby

require 'spec_helper'
describe "Student Landing", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
before(:all) do
ShoppingCart.delete_all
JamTrackRight.delete_all
JamTrack.delete_all
JamTrackTrack.delete_all
JamTrackLicensor.delete_all
end
let(:user) { FactoryGirl.create(:user, country: 'US') }
it "logged out" do
visit "/landing/jamclass/students"
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_123@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_123@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 "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.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)
# this should show on the /client#/home page (WILL CHANGE)
find('h1', text: 'musician profile')
user.reload
user.is_a_student.should be true
user.is_a_teacher.should be false
user.musician.should be true
end
end