2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Emails::ConfirmService do
|
2022-07-23 23:45:48 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
subject(:service) { described_class.new(user) }
|
|
|
|
|
|
|
|
describe '#execute' do
|
2020-05-24 23:13:21 +05:30
|
|
|
it 'enqueues a background job to send confirmation email again' do
|
2021-01-29 00:20:46 +05:30
|
|
|
email = user.emails.create!(email: 'new@email.com')
|
2020-05-24 23:13:21 +05:30
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
travel_to(10.minutes.from_now) do
|
|
|
|
expect { service.execute(email) }.to have_enqueued_job.on_queue('mailers')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|