Add tests for merge request update.
This commit is contained in:
parent
0fbf47a219
commit
931c56f822
2 changed files with 8 additions and 5 deletions
|
@ -36,7 +36,7 @@ describe Issues::UpdateService do
|
||||||
it { expect(@issue.labels.count).to eq(1) }
|
it { expect(@issue.labels.count).to eq(1) }
|
||||||
it { expect(@issue.labels.first.title).to eq('Bug') }
|
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
|
deliveries = ActionMailer::Base.deliveries
|
||||||
email = deliveries.last
|
email = deliveries.last
|
||||||
recipients = deliveries.last(2).map(&:to).flatten
|
recipients = deliveries.last(2).map(&:to).flatten
|
||||||
|
|
|
@ -3,7 +3,8 @@ require 'spec_helper'
|
||||||
describe MergeRequests::UpdateService do
|
describe MergeRequests::UpdateService do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:user2) { 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(:project) { merge_request.project }
|
||||||
let(:label) { create(:label) }
|
let(:label) { create(:label) }
|
||||||
|
|
||||||
|
@ -47,9 +48,11 @@ describe MergeRequests::UpdateService do
|
||||||
with(@merge_request, 'update')
|
with(@merge_request, 'update')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should send email to user2 about assign of new merge_request' do
|
it 'should send email to user2 about assign of new merge request and email to user3 about merge request unassignment' do
|
||||||
email = ActionMailer::Base.deliveries.last
|
deliveries = ActionMailer::Base.deliveries
|
||||||
expect(email.to.first).to eq(user2.email)
|
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)
|
expect(email.subject).to include(merge_request.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue