diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 18:08:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-23 18:08:41 +0300 |
commit | 5eeb39104356356bec81abe19479bca591e6f299 (patch) | |
tree | 7534ccf94fb8100ce39b78278d275b2061773f95 /spec/workers | |
parent | b7e512c8970dcce6feabc096885c7a1ea91e4694 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/members_destroyer/unassign_issuables_worker_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb b/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb new file mode 100644 index 00000000000..2a325be1225 --- /dev/null +++ b/spec/workers/members_destroyer/unassign_issuables_worker_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe MembersDestroyer::UnassignIssuablesWorker do + let_it_be(:group) { create(:group, :private) } + let_it_be(:user, reload: true) { create(:user) } + + context 'when unsupported membership source entity' do + it 'exits early and logs error' do + params = { message: "SomeEntity is not a supported entity.", entity_type: 'SomeEntity', entity_id: group.id, user_id: user.id } + + expect(Sidekiq.logger).to receive(:error).with(params) + + described_class.new.perform(user.id, group.id, 'SomeEntity') + end + end + + it "calls the Members::UnassignIssuablesService with the params it was given" do + service = double + + expect(Members::UnassignIssuablesService).to receive(:new).with(user, group).and_return(service) + expect(service).to receive(:execute) + + described_class.new.perform(user.id, group.id, 'Group') + end +end |