2016-04-26 03:01:15 +00:00
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
|
|
describe "School 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
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-26 15:01:53 +00:00
|
|
|
|
before(:each) do
|
|
|
|
|
|
AdminMailer.deliveries.clear
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2016-04-26 03:01:15 +00:00
|
|
|
|
let(:user) { FactoryGirl.create(:user, country: 'US') }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "logged out" do
|
|
|
|
|
|
visit "/landing/jamclass/schools"
|
|
|
|
|
|
|
2016-04-26 15:06:02 +00:00
|
|
|
|
find('h1.jam-track-name', 'GROW YOUR SCHOOL’S REACH & INCOME')
|
2016-04-26 03:01:15 +00:00
|
|
|
|
find('h2.original-artist', 'Do you own/operate a music school?')
|
|
|
|
|
|
|
|
|
|
|
|
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_interest_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('h2', text: 'sessions')
|
|
|
|
|
|
|
2016-04-26 15:01:53 +00:00
|
|
|
|
AdminMailer.deliveries.count.should eql 3 # welcome email, partners ping about new user, and
|
|
|
|
|
|
|
2016-04-26 03:01:15 +00:00
|
|
|
|
user = User.find_by_email('school_interest_123@jamkazam.com')
|
|
|
|
|
|
user.is_a_student.should be false
|
|
|
|
|
|
user.is_a_teacher.should be false
|
|
|
|
|
|
user.school_interest.should be true
|
2016-05-10 02:32:34 +00:00
|
|
|
|
user.owned_school.should_not be_nil
|
2016-05-16 16:39:20 +00:00
|
|
|
|
user.owned_school.affiliate_partner.should_not be_nil
|
2016-04-26 03:01:15 +00:00
|
|
|
|
user.musician.should be true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it "logged in" do
|
|
|
|
|
|
fast_signin(user,"/landing/jamclass/schools")
|
|
|
|
|
|
|
2016-04-26 15:06:02 +00:00
|
|
|
|
find('h1.jam-track-name', 'GROW YOUR SCHOOL’S REACH & INCOME')
|
2016-04-26 03:01:15 +00:00
|
|
|
|
find('h2.original-artist', 'Do you own/operate a music school?')
|
|
|
|
|
|
|
|
|
|
|
|
find('button.cta-button', text: 'SIGN UP').trigger(:click)
|
|
|
|
|
|
|
|
|
|
|
|
# this should show on the /client#/home page (WILL CHANGE)
|
|
|
|
|
|
find('h2', text: 'sessions')
|
|
|
|
|
|
|
|
|
|
|
|
user.reload
|
|
|
|
|
|
user.is_a_student.should be false
|
|
|
|
|
|
user.is_a_teacher.should be false
|
|
|
|
|
|
user.school_interest.should be true
|
|
|
|
|
|
user.musician.should be true
|
2016-05-10 02:32:34 +00:00
|
|
|
|
user.owned_school.should_not be_nil
|
2016-04-26 03:01:15 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|