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
8ca9e81f
Commit
8ca9e81f
authored
Feb 11, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add epic changed status email missing specs
Add missing specs for epic_status_changed_email
parent
c5de0a40
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
34 deletions
+46
-34
ee/spec/mailers/notify_spec.rb
ee/spec/mailers/notify_spec.rb
+46
-34
No files found.
ee/spec/mailers/notify_spec.rb
View file @
8ca9e81f
...
...
@@ -11,6 +11,39 @@ describe Notify do
include_context
'gitlab email notification'
RSpec
.
shared_examples
'epic notifications with reply'
do
it_behaves_like
'having group identification headers'
it_behaves_like
'it should show Gmail Actions View Epic link'
it_behaves_like
'an unsubscribeable thread'
it
'has the characteristics of a threaded reply'
do
host
=
Gitlab
.
config
.
gitlab
.
host
route_key
=
"
#{
epic
.
class
.
model_name
.
singular_route_key
}
_
#{
epic
.
id
}
"
aggregate_failures
do
is_expected
.
to
have_header
(
'Message-ID'
,
/\A<.*@
#{
host
}
>\Z/
)
is_expected
.
to
have_header
(
'In-Reply-To'
,
"<
#{
route_key
}
@
#{
host
}
>"
)
is_expected
.
to
have_header
(
'References'
,
/\A<reply\-.*@
#{
host
}
> <
#{
route_key
}
@
#{
host
}
>\Z/
)
is_expected
.
to
have_subject
(
/^Re: /
)
end
end
it
'has a Reply-To header'
do
is_expected
.
to
have_header
'Reply-To'
,
/<reply+(.*)@
#{
Gitlab
.
config
.
gitlab
.
host
}
>\Z/
end
it
'has the correct subject and body'
do
email_subject
=
"Re:
#{
epic
.
group
.
name
}
|
#{
epic
.
title
}
(
#{
epic
.
to_reference
}
)"
aggregate_failures
do
is_expected
.
to
have_subject
(
email_subject
)
is_expected
.
to
have_body_text
(
email_body
)
end
end
end
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:current_user
)
{
create
(
:user
,
email:
"current@email.com"
)
}
let_it_be
(
:assignee
)
{
create
(
:user
,
email:
'assignee@example.com'
,
name:
'John Doe'
)
}
...
...
@@ -319,48 +352,27 @@ describe Notify do
end
end
context
'that changed status'
do
let
(
:status
)
{
'reopened'
}
subject
{
described_class
.
epic_status_changed_email
(
recipient
.
id
,
epic
.
id
,
status
,
current_user
.
id
)
}
it_behaves_like
'epic notifications with reply'
do
let
(
:email_body
)
{
"Epic was
#{
status
}
by
#{
current_user
.
name
}
"
}
end
end
context
'for epic notes'
do
let_it_be
(
:note
)
{
create
(
:note
,
project:
nil
,
noteable:
epic
)
}
let
(
:note_author
)
{
note
.
author
}
let
(
:epic_note_path
)
{
group_epic_path
(
group
,
epic
,
anchor:
"note_
#{
note
.
id
}
"
)
}
subject
{
described_class
.
note_epic_email
(
recipient
.
id
,
note
.
id
)
}
it_behaves_like
'a note email'
it_behaves_like
'an unsubscribeable thread'
it_behaves_like
'having group identification headers'
it
'has the characteristics of a threaded reply'
do
host
=
Gitlab
.
config
.
gitlab
.
host
route_key
=
"
#{
epic
.
class
.
model_name
.
singular_route_key
}
_
#{
epic
.
id
}
"
aggregate_failures
do
is_expected
.
to
have_header
(
'Message-ID'
,
/\A<.*@
#{
host
}
>\Z/
)
is_expected
.
to
have_header
(
'In-Reply-To'
,
"<
#{
route_key
}
@
#{
host
}
>"
)
is_expected
.
to
have_header
(
'References'
,
/\A<reply\-.*@
#{
host
}
> <
#{
route_key
}
@
#{
host
}
>\Z/
)
is_expected
.
to
have_subject
(
/^Re: /
)
end
end
context
'when reply-by-email is enabled with incoming address with %{key}'
do
it
'has a Reply-To header'
do
is_expected
.
to
have_header
'Reply-To'
,
/<reply+(.*)@
#{
Gitlab
.
config
.
gitlab
.
host
}
>\Z/
end
it_behaves_like
'epic notifications with reply'
do
let
(
:email_body
)
{
group_epic_path
(
group
,
epic
,
anchor:
"note_
#{
note
.
id
}
"
)
}
end
it_behaves_like
'it should show Gmail Actions View Epic link'
it
'has the correct subject and body'
do
prefix
=
"Re:
#{
epic
.
group
.
name
}
| "
suffix
=
"
#{
epic
.
title
}
(
#{
epic
.
to_reference
}
)"
aggregate_failures
do
is_expected
.
to
have_subject
[
prefix
,
suffix
].
compact
.
join
is_expected
.
to
have_body_text
(
epic_note_path
)
end
end
it_behaves_like
'a note email'
end
end
end
...
...
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