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

62 lines
1.7 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.jam-track-name', 'JAMCLASS')
find('h2.original-artist', 'Finally, online music lessons that really work!')
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
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('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