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

73 lines
2.1 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
before(:each) do
AdminMailer.deliveries.clear
end
let(:user) { FactoryGirl.create(:user, country: 'US') }
it "logged out" do
visit "/landing/jamclass/schools"
find('h1.jam-track-name', 'GROW YOUR SCHOOLS REACH & INCOME')
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')
AdminMailer.deliveries.count.should eql 3 # welcome email, partners ping about new user, and
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
user.owned_school.should_not be_nil
user.owned_school.affiliate_partner.should_not be_nil
user.musician.should be true
end
it "logged in" do
fast_signin(user,"/landing/jamclass/schools")
find('h1.jam-track-name', 'GROW YOUR SCHOOLS REACH & INCOME')
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
user.owned_school.should_not be_nil
end
end