* First set of changes for Ahoy 2.0 * Fix line length * Change test * Remove unused test * Remove ahoy_messages.opened_at * Simply digest email sending calculation to not rely on last_opened * Remove outdated comment * Fix typo in test * Rework site config email digest to a single value * Fix merge duplication * Remove UTM references from ahoy emails * Fix credits tests * Remove UTM from expected email params
22 lines
712 B
Ruby
22 lines
712 B
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.with(user: user, articles: [article]).digest_email
|
|
|
|
expect(email.subject).not_to be_nil
|
|
expect(email.to).to eq([user.email])
|
|
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
|
expected_from = "#{SiteConfig.community_name} Digest <#{SiteConfig.email_addresses[:default]}>"
|
|
expect(email["from"].value).to eq(expected_from)
|
|
end
|
|
end
|
|
end
|