diff options
Diffstat (limited to 'spec/workers/new_issue_worker_spec.rb')
-rw-r--r-- | spec/workers/new_issue_worker_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/workers/new_issue_worker_spec.rb b/spec/workers/new_issue_worker_spec.rb index 35b83c3bee8..b9053b10419 100644 --- a/spec/workers/new_issue_worker_spec.rb +++ b/spec/workers/new_issue_worker_spec.rb @@ -74,6 +74,8 @@ RSpec.describe NewIssueWorker do it 'creates a new event record' do expect { worker.perform(issue.id, user.id) }.to change { Event.count }.from(0).to(1) + + expect(Event.last).to have_attributes(target_id: issue.id, target_type: 'Issue') end it 'creates a notification for the mentioned user' do @@ -89,6 +91,14 @@ RSpec.describe NewIssueWorker do worker.perform(issue.id, user.id) end + + context 'when a class is set' do + it 'creates event with the correct type' do + expect { worker.perform(issue.id, user.id, 'WorkItem') }.to change { Event.count }.from(0).to(1) + + expect(Event.last).to have_attributes(target_id: issue.id, target_type: 'WorkItem') + end + end end end end |