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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
7da750cc
Commit
7da750cc
authored
Nov 25, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specs for links in email notifications for Gmail Actions.
parent
ef2bc0f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
1 deletion
+93
-1
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+93
-1
No files found.
spec/mailers/notify_spec.rb
View file @
7da750cc
...
...
@@ -77,6 +77,14 @@ describe Notify do
end
end
shared_examples
'it should have Gmail Actions links'
do
it
{
is_expected
.
to
have_body_text
/ViewAction/
}
end
shared_examples
'it should not have Gmail Actions links'
do
it
{
is_expected
.
to_not
have_body_text
/ViewAction/
}
end
describe
'for new users, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
...
...
@@ -87,6 +95,7 @@ describe Notify do
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
,
new_user_address
it_behaves_like
'it should not have Gmail Actions links'
it
'contains the password text'
do
is_expected
.
to
have_body_text
/Click here to set your password/
...
...
@@ -115,6 +124,7 @@ describe Notify do
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'a new user email'
,
new_user_address
it_behaves_like
'it should not have Gmail Actions links'
it
'should not contain the new user\'s password'
do
is_expected
.
not_to
have_body_text
/password/
...
...
@@ -127,6 +137,7 @@ describe Notify do
subject
{
Notify
.
new_ssh_key_email
(
key
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
key
.
user
.
email
...
...
@@ -150,6 +161,8 @@ describe Notify do
subject
{
Notify
.
new_email_email
(
email
.
id
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent to the new user'
do
is_expected
.
to
deliver_to
email
.
user
.
email
end
...
...
@@ -194,6 +207,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
project
.
name
}
\|
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -202,6 +216,10 @@ describe Notify do
it
'contains a link to the new issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
describe
'that are new with a description'
do
...
...
@@ -217,6 +235,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -239,6 +258,10 @@ describe Notify do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
describe
'status changed'
do
...
...
@@ -246,6 +269,7 @@ describe Notify do
subject
{
Notify
.
issue_status_changed_email
(
recipient
.
id
,
issue
.
id
,
status
,
current_user
)
}
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -268,8 +292,11 @@ describe Notify do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
end
context
'for merge requests'
do
...
...
@@ -282,6 +309,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -302,14 +330,24 @@ describe Notify do
it
'has the correct message-id set'
do
is_expected
.
to
have_header
'Message-ID'
,
"<merge_request_
#{
merge_request
.
id
}
@
#{
Gitlab
.
config
.
gitlab
.
host
}
>"
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
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_behaves_like
'it should have Gmail Actions links'
it
'contains the description'
do
is_expected
.
to
have_body_text
/
#{
merge_request_with_description
.
description
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'that are reassigned'
do
...
...
@@ -317,6 +355,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -339,6 +378,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'status changed'
do
...
...
@@ -346,6 +389,8 @@ describe Notify do
subject
{
Notify
.
merge_request_status_email
(
recipient
.
id
,
merge_request
.
id
,
status
,
current_user
)
}
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -368,6 +413,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'that are merged'
do
...
...
@@ -375,6 +424,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the merge author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -393,6 +443,10 @@ describe Notify do
it
'contains a link to the merge request'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
end
...
...
@@ -403,6 +457,7 @@ describe Notify do
subject
{
Notify
.
project_was_moved_email
(
project
.
id
,
user
.
id
,
"gitlab/gitlab"
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Project was moved/
...
...
@@ -424,13 +479,16 @@ describe Notify do
subject
{
Notify
.
project_access_granted_email
(
project_member
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Access to project was granted/
end
it
'contains name of project'
do
is_expected
.
to
have_body_text
/
#{
project
.
name
}
/
end
it
'contains new user role'
do
is_expected
.
to
have_body_text
/
#{
project_member
.
human_access
}
/
end
...
...
@@ -445,6 +503,8 @@ describe Notify do
end
shared_examples
'a note email'
do
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
note_author
.
name
)
...
...
@@ -469,6 +529,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'commit'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
commit
.
title
}
\(
#{
commit
.
short_id
}
\)/
...
...
@@ -477,6 +538,10 @@ describe Notify do
it
'contains a link to the commit'
do
is_expected
.
to
have_body_text
commit
.
short_id
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
end
end
describe
'on a merge request'
do
...
...
@@ -488,6 +553,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -496,6 +562,10 @@ describe Notify do
it
'contains a link to the merge request note'
do
is_expected
.
to
have_body_text
/
#{
note_on_merge_request_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
describe
'on an issue'
do
...
...
@@ -507,6 +577,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -515,6 +586,10 @@ describe Notify do
it
'contains a link to the issue note'
do
is_expected
.
to
have_body_text
/
#{
note_on_issue_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
end
end
...
...
@@ -527,6 +602,7 @@ describe Notify do
subject
{
Notify
.
group_access_granted_email
(
membership
.
id
)
}
it_behaves_like
'an email sent from GitLab'
it_behaves_like
'it should not have Gmail Actions links'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/Access to group was granted/
...
...
@@ -574,6 +650,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :create
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -600,6 +678,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/tags/v1.0'
,
action: :create
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -625,6 +705,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :delete
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -646,6 +728,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/tags/v1.0'
,
action: :delete
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -671,6 +755,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :push
,
compare:
compare
,
reverse_compare:
false
,
send_from_committer_email:
send_from_committer_email
)
}
it_behaves_like
'it should not have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -774,6 +860,8 @@ describe Notify do
subject
{
Notify
.
repository_push_email
(
project
.
id
,
'devs@company.name'
,
author_id:
user
.
id
,
ref:
'refs/heads/master'
,
action: :push
,
compare:
compare
)
}
it_behaves_like
'it should have Gmail Actions links'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
display_name
).
to
eq
(
user
.
name
)
...
...
@@ -799,5 +887,9 @@ describe Notify do
it
'contains a link to the diff'
do
is_expected
.
to
have_body_text
/
#{
diff_path
}
/
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
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