blob: 47fdff9a8efe7c1b7dd35a89ba699d311bf528a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Namespaces::InviteTeamEmailWorker do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
it 'sends the email' do
expect(Namespaces::InviteTeamEmailService).to receive(:send_email).with(user, group).once
subject.perform(group.id, user.id)
end
context 'when user id is non-existent' do
it 'does not send the email' do
expect(Namespaces::InviteTeamEmailService).not_to receive(:send_email)
subject.perform(group.id, non_existing_record_id)
end
end
context 'when group id is non-existent' do
it 'does not send the email' do
expect(Namespaces::InviteTeamEmailService).not_to receive(:send_email)
subject.perform(non_existing_record_id, user.id)
end
end
end
|