Commit 931c56f8 authored by Douwe Maan's avatar Douwe Maan
Browse files

Add tests for merge request update.

parent 8788b4c7ae1e
......@@ -36,7 +36,7 @@
it { expect(@issue.labels.count).to eq(1) }
it { expect(@issue.labels.first.title).to eq('Bug') }
it 'should send email to user2 about assign of new issue and email to user about issue unassignment' do
it 'should send email to user2 about assign of new issue and email to user3 about issue unassignment' do
deliveries = ActionMailer::Base.deliveries
email = deliveries.last
recipients = deliveries.last(2).map(&:to).flatten
......
......@@ -3,7 +3,8 @@
describe MergeRequests::UpdateService do
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:merge_request) { create(:merge_request, :simple, title: 'Old title') }
let(:user3) { create(:user) }
let(:merge_request) { create(:merge_request, :simple, title: 'Old title', assignee_id: user3.id) }
let(:project) { merge_request.project }
let(:label) { create(:label) }
......@@ -47,9 +48,11 @@
with(@merge_request, 'update')
end
it 'should send email to user2 about assign of new merge_request' do
email = ActionMailer::Base.deliveries.last
expect(email.to.first).to eq(user2.email)
it 'should send email to user2 about assign of new merge request and email to user3 about merge request unassignment' do
deliveries = ActionMailer::Base.deliveries
email = deliveries.last
recipients = deliveries.last(2).map(&:to).flatten
expect(recipients).to include(user2.email, user3.email)
expect(email.subject).to include(merge_request.title)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment