diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/workers/new_issue_worker_spec.rb | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/workers/new_issue_worker_spec.rb')
-rw-r--r-- | spec/workers/new_issue_worker_spec.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/workers/new_issue_worker_spec.rb b/spec/workers/new_issue_worker_spec.rb index 6386af8d253..7cba3487603 100644 --- a/spec/workers/new_issue_worker_spec.rb +++ b/spec/workers/new_issue_worker_spec.rb @@ -11,13 +11,13 @@ RSpec.describe NewIssueWorker do expect(EventCreateService).not_to receive(:new) expect(NotificationService).not_to receive(:new) - worker.perform(99, create(:user).id) + worker.perform(non_existing_record_id, create(:user).id) end it 'logs an error' do - expect(Rails.logger).to receive(:error).with('NewIssueWorker: couldn\'t find Issue with ID=99, skipping job') + expect(Gitlab::AppLogger).to receive(:error).with("NewIssueWorker: couldn't find Issue with ID=#{non_existing_record_id}, skipping job") - worker.perform(99, create(:user).id) + worker.perform(non_existing_record_id, create(:user).id) end end @@ -26,23 +26,23 @@ RSpec.describe NewIssueWorker do expect(EventCreateService).not_to receive(:new) expect(NotificationService).not_to receive(:new) - worker.perform(create(:issue).id, 99) + worker.perform(create(:issue).id, non_existing_record_id) end it 'logs an error' do issue = create(:issue) - expect(Rails.logger).to receive(:error).with('NewIssueWorker: couldn\'t find User with ID=99, skipping job') + expect(Gitlab::AppLogger).to receive(:error).with("NewIssueWorker: couldn't find User with ID=#{non_existing_record_id}, skipping job") - worker.perform(issue.id, 99) + worker.perform(issue.id, non_existing_record_id) end end context 'when everything is ok' do - let(:project) { create(:project, :public) } - let(:mentioned) { create(:user) } - let(:user) { create(:user) } - let(:issue) { create(:issue, project: project, description: "issue for #{mentioned.to_reference}") } + let_it_be(:user) { create_default(:user) } + let_it_be(:project) { create(:project, :public) } + let_it_be(:mentioned) { create(:user) } + let_it_be(:issue) { create(:issue, project: project, description: "issue for #{mentioned.to_reference}") } it 'creates a new event record' do expect { worker.perform(issue.id, user.id) }.to change { Event.count }.from(0).to(1) @@ -50,7 +50,7 @@ RSpec.describe NewIssueWorker do it 'creates a notification for the mentioned user' do expect(Notify).to receive(:new_issue_email).with(mentioned.id, issue.id, NotificationReason::MENTIONED) - .and_return(double(deliver_later: true)) + .and_return(double(deliver_later: true)) worker.perform(issue.id, user.id) end |