discourse/spec/jobs/download_backup_email_spec.rb
David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00

21 lines
549 B
Ruby

# frozen_string_literal: true
RSpec.describe Jobs::DownloadBackupEmail do
fab!(:user) { Fabricate(:admin) }
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
))
expect(email.body.raw_source).to include("http://some.example.test/?token=#{EmailBackupToken.get(user.id)}")
end
end