require 'spec_helper' describe Applicants::ApplicantMailer do include EmailSpec::Helpers include EmailSpec::Matchers around do |example| Sidekiq::Testing.inline! do example.run end end describe "#record_your_desktop" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.record_your_desktop(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to Next Step: Complete a sample UserTesting recording" do @email.should have_subject("Next Step: Complete a sample UserTesting recording") end it "should have intro text" do @email.should have_body_text("Thanks for signing up to become a tester") end it "should have link to record desktop" do @email.should have_body_text(download_applicant_url(@applicant.id)) end end describe "#your_application_has_problems" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.your_application_has_problems(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting. Try Again" do @email.should have_subject("UserTesting - Please try your sample test again") end it "should have intro text" do @email.should have_body_text("Click here to begin the sample test.") @email.should have_body_text("Please read these tips and try again") @email.should have_body_text("UserTesting") end end describe "#youve_been_rejected" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.youve_been_rejected(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting Tester Sign Up" do @email.should have_subject("UserTesting - Your application to UserTesting") end it "should have intro text" do @email.should have_body_text("Thank you so much for applying to test with us.") @email.should have_body_text("Sadly, we have many more applicants than we can accept right now, so we aren't able to invite you to join our panel. We're very sorry to disappoint you, and we really appreciate you taking the time to apply.") @email.should have_body_text("The UserTesting team") end end describe "#youve_been_approved" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.youve_been_approved(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting Tester Sign Up" do @email.should have_subject("Next Step: Fill out your UserTesting profile") end it "should have intro text" do @email.should have_body_text("Congratulations") @email.should have_body_text("You're almost ready to start receiving paying tests from UserTesting. Once you complete your Profile, you'll be eligible to receive tests that match your demographics.") @email.should have_body_text(@applicant.fill_out_profile_url) end end describe "#restarted_for_audio_problem" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.restarted_for_audio_problem(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting - Technical problem with your application" do @email.should have_subject("UserTesting - Technical problem with your application") end it "should have body text" do @email.should have_body_text("there was an audio issue with your test video.") end end describe "#restarted_for_performance_problem" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.restarted_for_performance_problem(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting - Please try your sample test again" do @email.should have_subject("UserTesting - Please try your sample test again") end it "should have body text" do @email.should have_body_text("There was a performance problem on your sample video.") end it "should have the correct tester video link" do @email.body.should include tips_applicant_url(@applicant) end end describe "#restarted_for_video_problem" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.restarted_for_video_problem(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting - Technical problem with your application" do @email.should have_subject("UserTesting - Technical problem with your application") end it "should have body text" do @email.should have_body_text("there was a video issue with your test video.") end end describe "#video_received" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.video_received(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the subject to UserTesting: we've received your sample video" do @email.should have_subject("UserTesting: we've received your sample video") end it "should have body text" do @email.should have_body_text("Your sample video is being reviewed.") end end describe "#upload_video_reminder" do before do @applicant = Applicants::Applicant.create(email: 'fake@example.com', terms_of_use: "1") @email = Applicants::ApplicantMailer.upload_video_reminder(@applicant.id) end it "should be delivered to the email passed in" do @email.should deliver_to("fake@example.com") end it "should be from support" do @email.should deliver_from("UserTesting Support ") end it "should set the correct subject" do @email.should have_subject("UserTesting: Please come back to complete your application") end it "should have body text" do @email.should have_body_text("We haven't received your sample video.") end end end