summaryrefslogtreecommitdiff
path: root/spec/workers/namespaces/invite_team_email_worker_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/namespaces/invite_team_email_worker_spec.rb')
-rw-r--r--spec/workers/namespaces/invite_team_email_worker_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/namespaces/invite_team_email_worker_spec.rb b/spec/workers/namespaces/invite_team_email_worker_spec.rb
new file mode 100644
index 00000000000..47fdff9a8ef
--- /dev/null
+++ b/spec/workers/namespaces/invite_team_email_worker_spec.rb
@@ -0,0 +1,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