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
Kazuhiko Shiozaki
gitlab-ce
Commits
5c0be319
Commit
5c0be319
authored
Nov 25, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some repetition in notify spec.
parent
56135927
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
61 deletions
+32
-61
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+32
-61
No files found.
spec/mailers/notify_spec.rb
View file @
5c0be319
...
@@ -85,6 +85,24 @@ describe Notify do
...
@@ -85,6 +85,24 @@ describe Notify do
it
{
is_expected
.
to_not
have_body_text
/ViewAction/
}
it
{
is_expected
.
to_not
have_body_text
/ViewAction/
}
end
end
shared_examples
'it should show Gmail Actions View Issue link'
do
it_behaves_like
'it should have Gmail Actions links'
it
{
is_expected
.
to
have_body_text
/View Issue/
}
end
shared_examples
'it should show Gmail Actions View Merge request link'
do
it_behaves_like
'it should have Gmail Actions links'
it
{
is_expected
.
to
have_body_text
/View Merge request/
}
end
shared_examples
'it should show Gmail Actions View Commit link'
do
it_behaves_like
'it should have Gmail Actions links'
it
{
is_expected
.
to
have_body_text
/View Commit/
}
end
describe
'for new users, the email'
do
describe
'for new users, the email'
do
let
(
:example_site_path
)
{
root_path
}
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
...
@@ -207,7 +225,7 @@ describe Notify do
...
@@ -207,7 +225,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'issue'
it_behaves_like
'an email starting a new thread'
,
'issue'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'has the correct subject'
do
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
project
.
name
}
\|
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
is_expected
.
to
have_subject
/
#{
project
.
name
}
\|
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
@@ -216,15 +234,13 @@ describe Notify do
...
@@ -216,15 +234,13 @@ describe Notify do
it
'contains a link to the new issue'
do
it
'contains a link to the new issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
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
describe
'that are new with a description'
do
describe
'that are new with a description'
do
subject
{
Notify
.
new_issue_email
(
issue_with_description
.
assignee_id
,
issue_with_description
.
id
)
}
subject
{
Notify
.
new_issue_email
(
issue_with_description
.
assignee_id
,
issue_with_description
.
id
)
}
it_behaves_like
'it should show Gmail Actions View Issue link'
it
'contains the description'
do
it
'contains the description'
do
is_expected
.
to
have_body_text
/
#{
issue_with_description
.
description
}
/
is_expected
.
to
have_body_text
/
#{
issue_with_description
.
description
}
/
end
end
...
@@ -235,7 +251,7 @@ describe Notify do
...
@@ -235,7 +251,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'is sent as the author'
do
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -258,10 +274,6 @@ describe Notify do
...
@@ -258,10 +274,6 @@ describe Notify do
it
'contains a link to the issue'
do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
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
describe
'status changed'
do
describe
'status changed'
do
...
@@ -269,7 +281,7 @@ describe Notify do
...
@@ -269,7 +281,7 @@ describe Notify do
subject
{
Notify
.
issue_status_changed_email
(
recipient
.
id
,
issue
.
id
,
status
,
current_user
)
}
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
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'is sent as the author'
do
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -292,10 +304,6 @@ describe Notify do
...
@@ -292,10 +304,6 @@ describe Notify do
it
'contains a link to the issue'
do
it
'contains a link to the issue'
do
is_expected
.
to
have_body_text
/
#{
namespace_project_issue_path
project
.
namespace
,
project
,
issue
}
/
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
end
end
...
@@ -309,7 +317,7 @@ describe Notify do
...
@@ -309,7 +317,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread'
,
'merge_request'
it_behaves_like
'an email starting a new thread'
,
'merge_request'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'has the correct subject'
do
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
@@ -330,24 +338,16 @@ describe Notify do
...
@@ -330,24 +338,16 @@ describe Notify do
it
'has the correct message-id set'
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
}
>"
is_expected
.
to
have_header
'Message-ID'
,
"<merge_request_
#{
merge_request
.
id
}
@
#{
Gitlab
.
config
.
gitlab
.
host
}
>"
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
describe
'that are new with a description'
do
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
)
}
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_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'contains the description'
do
it
'contains the description'
do
is_expected
.
to
have_body_text
/
#{
merge_request_with_description
.
description
}
/
is_expected
.
to
have_body_text
/
#{
merge_request_with_description
.
description
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
describe
'that are reassigned'
do
describe
'that are reassigned'
do
...
@@ -355,7 +355,7 @@ describe Notify do
...
@@ -355,7 +355,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'is sent as the author'
do
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -378,10 +378,6 @@ describe Notify do
...
@@ -378,10 +378,6 @@ describe Notify do
it
'contains a link to the merge request'
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
}
/
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
describe
'status changed'
do
describe
'status changed'
do
...
@@ -389,8 +385,7 @@ describe Notify do
...
@@ -389,8 +385,7 @@ describe Notify do
subject
{
Notify
.
merge_request_status_email
(
recipient
.
id
,
merge_request
.
id
,
status
,
current_user
)
}
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
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should have Gmail Actions links'
it_behaves_like
'it should show Gmail Actions View Merge request link'
it
'is sent as the author'
do
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -413,10 +408,6 @@ describe Notify do
...
@@ -413,10 +408,6 @@ describe Notify do
it
'contains a link to the merge request'
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
}
/
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
describe
'that are merged'
do
describe
'that are merged'
do
...
@@ -424,7 +415,7 @@ describe Notify do
...
@@ -424,7 +415,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'is sent as the merge author'
do
it
'is sent as the merge author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -443,10 +434,6 @@ describe Notify do
...
@@ -443,10 +434,6 @@ describe Notify do
it
'contains a link to the merge request'
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
}
/
is_expected
.
to
have_body_text
/
#{
namespace_project_merge_request_path
project
.
namespace
,
project
,
merge_request
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
end
end
end
end
...
@@ -529,7 +516,7 @@ describe Notify do
...
@@ -529,7 +516,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'commit'
it_behaves_like
'an answer to an existing thread'
,
'commit'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Commit link
'
it
'has the correct subject'
do
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
commit
.
title
}
\(
#{
commit
.
short_id
}
\)/
is_expected
.
to
have_subject
/
#{
commit
.
title
}
\(
#{
commit
.
short_id
}
\)/
...
@@ -538,10 +525,6 @@ describe Notify do
...
@@ -538,10 +525,6 @@ describe Notify do
it
'contains a link to the commit'
do
it
'contains a link to the commit'
do
is_expected
.
to
have_body_text
commit
.
short_id
is_expected
.
to
have_body_text
commit
.
short_id
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
end
end
end
describe
'on a merge request'
do
describe
'on a merge request'
do
...
@@ -553,7 +536,7 @@ describe Notify do
...
@@ -553,7 +536,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'an answer to an existing thread'
,
'merge_request'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'has the correct subject'
do
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
@@ -562,10 +545,6 @@ describe Notify do
...
@@ -562,10 +545,6 @@ describe Notify do
it
'contains a link to the merge request note'
do
it
'contains a link to the merge request note'
do
is_expected
.
to
have_body_text
/
#{
note_on_merge_request_path
}
/
is_expected
.
to
have_body_text
/
#{
note_on_merge_request_path
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Merge request/
end
end
end
describe
'on an issue'
do
describe
'on an issue'
do
...
@@ -577,7 +556,7 @@ describe Notify do
...
@@ -577,7 +556,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'an answer to an existing thread'
,
'issue'
it_behaves_like
'it should
have Gmail Actions links
'
it_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'has the correct subject'
do
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
is_expected
.
to
have_subject
/
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
@@ -586,10 +565,6 @@ describe Notify do
...
@@ -586,10 +565,6 @@ describe Notify do
it
'contains a link to the issue note'
do
it
'contains a link to the issue note'
do
is_expected
.
to
have_body_text
/
#{
note_on_issue_path
}
/
is_expected
.
to
have_body_text
/
#{
note_on_issue_path
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Issue/
end
end
end
end
end
end
end
...
@@ -860,7 +835,7 @@ describe Notify do
...
@@ -860,7 +835,7 @@ 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
)
}
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_behaves_like
'it should
show Gmail Actions View Commit link
'
it
'is sent as the author'
do
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
@@ -887,9 +862,5 @@ describe Notify do
...
@@ -887,9 +862,5 @@ describe Notify do
it
'contains a link to the diff'
do
it
'contains a link to the diff'
do
is_expected
.
to
have_body_text
/
#{
diff_path
}
/
is_expected
.
to
have_body_text
/
#{
diff_path
}
/
end
end
it
'Gmail Actions contain correct action name'
do
is_expected
.
to
have_body_text
/View Commit/
end
end
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