* feat: add placeholders for some routes * about_listings_url * feat: tag-moderation * chore: about_listings_url test * chore: use post a job url * chore: add pages methods * chore: just reordered stuff * oops forgot to save - oh man * chore: change to single quotes * chore: hopefully retrigger cc * chore: update tests * feat: PR suggestions:) * chore: spec
33 lines
1.1 KiB
Ruby
33 lines
1.1 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe DigestMailer, type: :mailer do
|
|
let(:user) { build_stubbed(:user) }
|
|
let(:article) { build_stubbed(:article) }
|
|
|
|
describe "#digest_email" do
|
|
before do
|
|
allow(article).to receive(:title).and_return("test title")
|
|
end
|
|
|
|
it "works correctly" do
|
|
email = described_class.digest_email(user, [article])
|
|
|
|
expect(email.subject).not_to be_nil
|
|
expect(email.to).to eq([user.email])
|
|
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
|
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Digest <#{SiteConfig.email_addresses[:default]}>")
|
|
end
|
|
|
|
it "includes the tracking pixel" do
|
|
email = described_class.digest_email(user, [article])
|
|
expect(email.body).to include("open.gif")
|
|
end
|
|
|
|
it "includes UTM params" do
|
|
email = described_class.digest_email(user, [article])
|
|
expect(email.body).to include(CGI.escape("utm_medium=email"))
|
|
expect(email.body).to include(CGI.escape("utm_source=digest_mailer"))
|
|
expect(email.body).to include(CGI.escape("utm_campaign=digest_email"))
|
|
end
|
|
end
|
|
end
|