added 260907 version of worker toolkit

This commit is contained in:
2026-09-08 20:30:51 -04:00
parent cbd3f0f8ca
commit 97aca37663
1283 changed files with 142951 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
require "rails_helper"
RSpec.describe CheckinReminderMailer, type: :mailer do
describe "checkin reminder email" do
let(:user_email) { create(:user, email: "test@flaredown.com").email }
let(:mail) { CheckinReminderMailer.remind(email: user_email) }
it "renders the headers" do
expect(mail.subject).to eq(I18n.t("checkin_reminder_mailer.subject"))
expect(mail.to).to eq([user_email])
expect(mail.from).to eq(["from@some.email"])
end
it "renders the body" do
body = I18n.t("checkin_reminder_mailer.body.text", base_url: Rails.application.secrets.base_url)
expect(mail.body.encoded.strip.tr('\"', "")).to match(body)
end
it "renders the attachment" do
expect(mail.attachments.count).to eq 1
end
end
end

View File

@@ -0,0 +1,6 @@
class CheckinReminderMailerPreview < ActionMailer::Preview
# Preview emails at http://localhost:3000/rails/mailers/checkin_reminder_mailer/remind
def remind
CheckinReminderMailer.remind(email: "test@flaredown.com")
end
end

View File

@@ -0,0 +1,11 @@
class TopPostsMailerPreview < ActionMailer::Preview
# Preview emails at http://localhost:3000/rails/mailers/top_posts_mailer/notify
def notify
TopPostsMailer.notify(email: "test@flaredown.com", top_posts_ids: top_posts_ids)
end
def top_posts_ids
posts = Post.pluck(:id).map(&:to_s)
posts.any? ? posts.first(5) : []
end
end

View File

@@ -0,0 +1,7 @@
# Preview all emails at http://localhost:3000/rails/mailers/user_data_mailer
class UserDataMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/user_data_mailer/trackings_csv
def trackings_csv
UserDataMailer.trackings_csv("some@email.yo", "header1,header2\nvalue1, value2\n")
end
end

View File

@@ -0,0 +1,23 @@
require "rails_helper"
describe UserDataMailer do
describe "trackings_csv" do
let(:mail) { UserDataMailer.trackings_csv(to_email, "header1,header2\nvalue1, value2\n") }
let(:to_email) { "some@email.yo" }
it "renders the headers" do
expect(mail.subject).to eq(I18n.t("user_data_mailer.trackings_csv.subject"))
expect(mail.to).to eq([to_email])
expect(mail.from).to eq(["from@some.email"])
end
it "renders the body" do
expect(mail.body.encoded).to match("- The Flaredown Team")
end
it "has attachment" do
expect(mail.attachments.count).to eq 1
expect(mail.attachments.first.content_type).to eq "text/csv; filename=data.csv"
end
end
end