2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-18 11:25:22 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Jobs::DownloadBackupEmail do
|
2019-05-07 11:12:20 +08:00
|
|
|
fab!(:user) { Fabricate(:admin) }
|
2017-12-18 11:25:22 +08:00
|
|
|
|
|
|
|
it "should work" do
|
|
|
|
described_class.new.execute(
|
|
|
|
user_id: user.id,
|
|
|
|
backup_file_path: "http://some.example.test/"
|
|
|
|
)
|
|
|
|
|
|
|
|
email = ActionMailer::Base.deliveries.last
|
|
|
|
|
|
|
|
expect(email.subject).to eq(I18n.t('download_backup_mailer.subject_template',
|
|
|
|
email_prefix: SiteSetting.title
|
|
|
|
))
|
|
|
|
|
2018-04-26 04:34:23 +08:00
|
|
|
expect(email.body.raw_source).to include("http://some.example.test/?token=#{EmailBackupToken.get(user.id)}")
|
2017-12-18 11:25:22 +08:00
|
|
|
end
|
|
|
|
end
|