BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
61 deletions
+32
-61
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
it
{
is_expected
.
to_not
have_body_text
/ViewAction/
}
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
let
(
:example_site_path
)
{
root_path
}
let
(
:new_user
)
{
create
(
:user
,
email:
new_user_address
,
created_by_id:
1
)
}
...
...
@@ -207,7 +225,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_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
project
.
name
}
\|
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -216,15 +234,13 @@ 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
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
is_expected
.
to
have_body_text
/
#{
issue_with_description
.
description
}
/
end
...
...
@@ -235,7 +251,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_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -258,10 +274,6 @@ 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
...
...
@@ -269,7 +281,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_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -292,10 +304,6 @@ 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
end
...
...
@@ -309,7 +317,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_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -330,24 +338,16 @@ 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_behaves_like
'it should
show Gmail Actions View Merge request link
'
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
...
...
@@ -355,7 +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_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -378,10 +378,6 @@ 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
...
...
@@ -389,8 +385,7 @@ 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_behaves_like
'it should show Gmail Actions View Merge request link'
it
'is sent as the author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -413,10 +408,6 @@ 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
...
...
@@ -424,7 +415,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_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'is sent as the merge author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -443,10 +434,6 @@ 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
...
...
@@ -529,7 +516,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_behaves_like
'it should
show Gmail Actions View Commit link
'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
commit
.
title
}
\(
#{
commit
.
short_id
}
\)/
...
...
@@ -538,10 +525,6 @@ 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
...
...
@@ -553,7 +536,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_behaves_like
'it should
show Gmail Actions View Merge request link
'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
merge_request
.
title
}
\(#
#{
merge_request
.
iid
}
\)/
...
...
@@ -562,10 +545,6 @@ 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
...
...
@@ -577,7 +556,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_behaves_like
'it should
show Gmail Actions View Issue link
'
it
'has the correct subject'
do
is_expected
.
to
have_subject
/
#{
issue
.
title
}
\(#
#{
issue
.
iid
}
\)/
...
...
@@ -586,10 +565,6 @@ 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
...
...
@@ -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
)
}
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
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
...
...
@@ -887,9 +862,5 @@ 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