Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0371858b
Commit
0371858b
authored
Dec 11, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for the service desk emails
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
c077a9bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
ee/app/mailers/emails/service_desk.rb
ee/app/mailers/emails/service_desk.rb
+3
-4
ee/spec/mailers/notify_spec.rb
ee/spec/mailers/notify_spec.rb
+38
-0
No files found.
ee/app/mailers/emails/service_desk.rb
View file @
0371858b
...
...
@@ -11,13 +11,13 @@ module Emails
def
service_desk_thank_you_email
(
issue_id
)
setup_service_desk_mail
(
issue_id
)
mail_new_thread
(
@issue
,
service_desk_options
(
@support_bot
.
id
))
mail_new_thread
(
@issue
,
service_desk_options
(
@support_bot
.
id
)
.
merge
(
subject:
"Re:
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
)
)
end
def
service_desk_new_note_email
(
issue_id
,
note_id
)
@note
=
Note
.
find
(
note_id
)
setup_service_desk_mail
(
issue_id
)
mail_answer_thread
(
@issue
,
service_desk_options
(
@note
.
author_id
))
mail_answer_thread
(
@issue
,
service_desk_options
(
@note
.
author_id
)
.
merge
(
subject:
"
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
)
)
end
private
...
...
@@ -33,8 +33,7 @@ module Emails
def
service_desk_options
(
author_id
)
{
from:
sender
(
author_id
),
to:
@issue
.
service_desk_reply_to
,
subject:
"Re:
#{
@issue
.
title
}
(#
#{
@issue
.
iid
}
)"
to:
@issue
.
service_desk_reply_to
}
end
end
...
...
ee/spec/mailers/notify_spec.rb
View file @
0371858b
...
...
@@ -4,6 +4,7 @@ require 'email_spec'
describe
Notify
do
include
EmailSpec
::
Helpers
include
EmailSpec
::
Matchers
include
EmailHelpers
include
RepoHelpers
include_context
'gitlab email notification'
...
...
@@ -20,6 +21,13 @@ describe Notify do
description:
'Awesome description'
)
end
set
(
:issue
)
do
create
(
:issue
,
author:
current_user
,
assignees:
[
assignee
],
project:
project
,
description:
'My awesome description!'
)
end
set
(
:project2
)
{
create
(
:project
,
:repository
)
}
set
(
:merge_request_without_assignee
)
do
create
(
:merge_request
,
source_project:
project2
,
...
...
@@ -28,6 +36,36 @@ describe Notify do
end
context
'for a project'
do
context
'for service desk issues'
do
describe
'thank you email'
do
subject
{
described_class
.
service_desk_thank_you_email
(
issue
.
id
)
}
it_behaves_like
'an unsubscribeable thread'
it
'has the correct subject and body'
do
aggregate_failures
do
is_expected
.
to
have_referable_subject
(
issue
,
include_project:
false
,
reply:
true
)
is_expected
.
to
have_body_text
(
"Thank you for your support request! We are tracking your request as ticket
#{
issue
.
to_reference
}
, and will respond as soon as we can."
)
end
end
end
describe
'new note email'
do
set
(
:first_note
)
{
create
(
:discussion_note_on_issue
,
note:
'Hello world'
)
}
subject
{
described_class
.
service_desk_new_note_email
(
issue
.
id
,
first_note
.
id
)
}
it_behaves_like
'an unsubscribeable thread'
it
'has the correct subject and body'
do
aggregate_failures
do
is_expected
.
to
have_referable_subject
(
issue
,
include_project:
false
,
reply:
true
)
is_expected
.
to
have_body_text
(
first_note
.
note
)
end
end
end
end
context
'for merge requests'
do
describe
"that are new with approver"
do
before
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment