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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
8f0051e2
Commit
8f0051e2
authored
Jun 23, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test
@all
mentioning notifications.
parent
185da5f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+44
-0
No files found.
spec/services/notification_service_spec.rb
View file @
8f0051e2
...
@@ -95,6 +95,49 @@ describe NotificationService do
...
@@ -95,6 +95,49 @@ describe NotificationService do
end
end
end
end
context
'issue note mention'
do
let
(
:issue
)
{
create
(
:issue
,
assignee:
create
(
:user
))
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignee:
issue
.
assignee
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@all mentioned'
)
}
before
do
build_team
(
note
.
project
)
end
describe
:new_note
do
it
do
# Notify all team members
note
.
project
.
team
.
members
.
each
do
|
member
|
# User with disabled notification should not be notified
next
if
member
.
id
==
@u_disabled
.
id
should_email
(
member
.
id
)
end
should_email
(
note
.
noteable
.
author_id
)
should_email
(
note
.
noteable
.
assignee_id
)
should_not_email
(
note
.
author_id
)
should_not_email
(
@u_disabled
.
id
)
should_not_email
(
@u_not_mentioned
.
id
)
notification
.
new_note
(
note
)
end
it
'filters out "mentioned in" notes'
do
mentioned_note
=
Note
.
create_cross_reference_note
(
mentioned_issue
,
issue
,
issue
.
author
,
issue
.
project
)
Notify
.
should_not_receive
(
:note_issue_email
)
notification
.
new_note
(
mentioned_note
)
end
end
def
should_email
(
user_id
)
Notify
.
should_receive
(
:note_issue_email
).
with
(
user_id
,
note
.
id
)
end
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:note_issue_email
).
with
(
user_id
,
note
.
id
)
end
end
context
'commit note'
do
context
'commit note'
do
let
(
:note
)
{
create
(
:note_on_commit
)
}
let
(
:note
)
{
create
(
:note_on_commit
)
}
...
@@ -312,6 +355,7 @@ describe NotificationService do
...
@@ -312,6 +355,7 @@ describe NotificationService do
@u_disabled
=
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
@u_disabled
=
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_committer
=
create
(
:user
,
username:
'committer'
)
@u_committer
=
create
(
:user
,
username:
'committer'
)
@u_not_mentioned
=
create
(
:user
,
username:
'regular'
,
notification_level:
Notification
::
N_PARTICIPATING
)
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
...
...
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