fix pull requests api specs
This commit is contained in:
parent
7f5a8c527b
commit
0f004ea91f
|
@ -294,33 +294,26 @@ describe Api::V1::PullRequestsController, type: :controller do
|
||||||
ActionMailer::Base.deliveries = []
|
ActionMailer::Base.deliveries = []
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should send two email messages to project admins' do
|
it 'should send two email messages to all project members' do
|
||||||
post :create, @create_params
|
post :create, @create_params
|
||||||
# @project.pull_requests.last.issue.send(:new_issue_notifications)
|
expect(ActionMailer::Base.deliveries.count).to eq 3 # project owner + reader + admin
|
||||||
# @project.pull_requests.last.issue.send(:send_assign_notifications)
|
|
||||||
expect(ActionMailer::Base.deliveries.count).to eq 2
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should send two email messages to admins and one to assignee' do
|
it 'should send two email messages to admins and one to assignee' do
|
||||||
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_reader.id})
|
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_reader.id})
|
||||||
# @project.pull_requests.last.issue.send(:new_issue_notifications)
|
|
||||||
# @project.pull_requests.last.issue.send(:send_assign_notifications)
|
|
||||||
expect(ActionMailer::Base.deliveries.count).to eq 3
|
expect(ActionMailer::Base.deliveries.count).to eq 3
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should send email message to new assignee' do
|
it 'should send email message to new assignee' do
|
||||||
http_login(@project_admin)
|
http_login(@project_admin)
|
||||||
put :update, @update_params.deep_merge(pull_request: {assignee_id: @project_reader.id})
|
put :update, @update_params.deep_merge(pull_request: {assignee_id: @project_reader.id})
|
||||||
# @project.pull_requests.last.issue.send(:send_assign_notifications)
|
|
||||||
expect(ActionMailer::Base.deliveries.count).to eq 1
|
expect(ActionMailer::Base.deliveries.count).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not duplicate email message' do
|
it 'should not duplicate email message' do
|
||||||
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_admin.id})
|
post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_admin.id})
|
||||||
# @project.pull_requests.last.issue.send(:new_issue_notifications)
|
expect(ActionMailer::Base.deliveries.count).to eq 2 # send to all project members
|
||||||
# @project.pull_requests.last.issue.send(:send_assign_notifications)
|
expect(ActionMailer::Base.deliveries.map(&:to).uniq).to match_array(ActionMailer::Base.deliveries.map(&:to))
|
||||||
expect(ActionMailer::Base.deliveries.count).to eq 2 # send only to admins
|
|
||||||
expect(ActionMailer::Base.deliveries.first.to).to_not eq ActionMailer::Base.deliveries.last.to
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue