require "rails_helper" RSpec.describe AdminMailer do describe ".new_video" do let(:project) { build(:project, account: build(:account, name: "Test Account")) } let(:video) { create(:video, project: project) } let(:mail) { AdminMailer.new_video(video) } it "renders the headers" do expect(mail.subject).to eq("[New Video] Test Account has uploaded a new video") expect(mail.to).to eq(["bray@bigmedia.ai", "lee@bigmedia.ai"]) expect(mail.from).to eq(["support@bigmedia.ai"]) end it "renders the body" do expect(mail.body.encoded).to match(video_video_analyses_path(video, locale: I18n.locale)) end end describe ".updated_video_edl_file" do let(:project) { build(:project, account: build(:account, name: "Test Account")) } let(:video) { create(:video, project: project) } let(:mail) { AdminMailer.updated_video_edl_file(video) } it "renders the headers" do expect(mail.subject).to eq("[Updated Video EDL File] Test Account has updated the EDL file for video_file.mp4") expect(mail.to).to eq(["bray@bigmedia.ai", "lee@bigmedia.ai"]) expect(mail.from).to eq(["support@bigmedia.ai"]) end it "renders the body" do expect(mail.body.encoded).to match(video_video_analyses_path(video, locale: I18n.locale)) expect(mail.body.encoded).to include "An EDL file has been updated" end end describe ".updated_video_graphics_only_edl_file" do let(:project) { build(:project, account: build(:account, name: "Test Account")) } let(:video) { create(:video, project: project) } let(:mail) { AdminMailer.updated_video_graphics_only_edl_file(video) } it "renders the headers" do expect(mail.subject).to eq("[Updated Video Graphics Only EDL File] Test Account has updated the Graphics Only EDL file for video_file.mp4") expect(mail.to).to eq(["bray@bigmedia.ai", "lee@bigmedia.ai"]) expect(mail.from).to eq(["support@bigmedia.ai"]) end it "renders the body" do expect(mail.body.encoded).to match(video_video_analyses_path(video, locale: I18n.locale)) expect(mail.body.encoded).to include "A Graphics Only EDL file has been updated" end end describe ".updated_video_audio_only_edl_file" do let(:project) { build(:project, account: build(:account, name: "Test Account")) } let(:video) { create(:video, project: project) } let(:mail) { AdminMailer.updated_video_audio_only_edl_file(video) } it "renders the headers" do expect(mail.subject).to eq("[Updated Video Audio Only EDL File] Test Account has updated the Audio Only EDL file for video_file.mp4") expect(mail.to).to eq(["bray@bigmedia.ai", "lee@bigmedia.ai"]) expect(mail.from).to eq(["support@bigmedia.ai"]) end it "renders the body" do expect(mail.body.encoded).to match(video_video_analyses_path(video, locale: I18n.locale)) expect(mail.body.encoded).to include "An Audio Only EDL file has been updated" end end end