discourse/spec/jobs/download_backup_email_spec.rb
Daniel Waterworth e219588142 DEV: Prefabrication (test optimization) (#7414)
* Introduced fab!, a helper that creates database state for a group

It's almost identical to let_it_be, except:

 1. It creates a new object for each test by default,
 2. You can disable it using PREFABRICATION=0
2019-05-07 13:12:20 +10:00

23 lines
573 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
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