Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mailers/notify_spec.rb')
-rw-r--r--spec/mailers/notify_spec.rb54
1 files changed, 49 insertions, 5 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 6ba4d97ad4a..22d60429ccd 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -146,7 +146,8 @@ describe Notify do
end
context 'for issues' do
- let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project ) }
+ let(:issue) { create(:issue, author: current_user, assignee: assignee, project: project) }
+ let(:issue_with_description) { create(:issue, author: current_user, assignee: assignee, project: project, description: Faker::Lorem.sentence) }
describe 'that are new' do
subject { Notify.new_issue_email(issue.assignee_id, issue.id) }
@@ -162,6 +163,14 @@ describe Notify do
end
end
+ describe 'that are new with a description' do
+ subject { Notify.new_issue_email(issue_with_description.assignee_id, issue_with_description.id) }
+
+ it 'contains the description' do
+ should have_body_text /#{issue_with_description.description}/
+ end
+ end
+
describe 'that have been reassigned' do
subject { Notify.reassigned_issue_email(recipient.id, issue.id, previous_assignee.id, current_user) }
@@ -220,7 +229,9 @@ describe Notify do
end
context 'for merge requests' do
+ let(:merge_author) { create(:user) }
let(:merge_request) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project) }
+ let(:merge_request_with_description) { create(:merge_request, author: current_user, assignee: assignee, source_project: project, target_project: project, description: Faker::Lorem.sentence) }
describe 'that are new' do
subject { Notify.new_merge_request_email(merge_request.assignee_id, merge_request.id) }
@@ -244,6 +255,14 @@ describe Notify do
end
end
+ describe 'that are new with a description' do
+ subject { Notify.new_merge_request_email(merge_request_with_description.assignee_id, merge_request_with_description.id) }
+
+ it 'contains the description' do
+ should have_body_text /#{merge_request_with_description.description}/
+ end
+ end
+
describe 'that are reassigned' do
subject { Notify.reassigned_merge_request_email(recipient.id, merge_request.id, previous_assignee.id, current_user.id) }
@@ -270,7 +289,30 @@ describe Notify do
it 'contains a link to the merge request' do
should have_body_text /#{project_merge_request_path project, merge_request}/
end
+ end
+
+ describe 'that are merged' do
+ subject { Notify.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) }
+
+ it_behaves_like 'a multiple recipients email'
+
+ it 'is sent as the merge author' do
+ sender = subject.header[:from].addrs[0]
+ sender.display_name.should eq(merge_author.name)
+ sender.address.should eq(gitlab_sender)
+ end
+
+ it 'has the correct subject' do
+ should have_subject /#{merge_request.title} \(!#{merge_request.iid}\)/
+ end
+
+ it 'contains the new status' do
+ should have_body_text /merged/i
+ end
+ it 'contains a link to the merge request' do
+ should have_body_text /#{project_merge_request_path project, merge_request}/
+ end
end
end
end
@@ -335,10 +377,6 @@ describe Notify do
should deliver_to recipient.email
end
- it 'contains the name of the note\'s author' do
- should have_body_text /#{note_author.name}/
- end
-
it 'contains the message from the note' do
should have_body_text /#{note.note}/
end
@@ -468,6 +506,8 @@ describe Notify do
let(:example_site_path) { root_path }
let(:user) { create(:user) }
let(:compare) { Gitlab::Git::Compare.new(project.repository.raw_repository, 'cd5c4bac', 'b1e6a9db') }
+ let(:commits) { Commit.decorate(compare.commits) }
+ let(:diff_path) { project_compare_path(project, from: commits.first, to: commits.last) }
subject { Notify.repository_push_email(project.id, 'devs@company.name', user.id, 'master', compare) }
@@ -492,5 +532,9 @@ describe Notify do
it 'includes diffs' do
should have_body_text /Checkout wiki pages for installation information/
end
+
+ it 'contains a link to the diff' do
+ should have_body_text /#{diff_path}/
+ end
end
end