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
Boxiang Sun
gitlab-ce
Commits
f4f0a7e0
Commit
f4f0a7e0
authored
Mar 28, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a failing test.
parent
69432c88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+31
-4
No files found.
spec/services/notification_service_spec.rb
View file @
f4f0a7e0
...
@@ -57,15 +57,42 @@ describe NotificationService do
...
@@ -57,15 +57,42 @@ describe NotificationService do
Notify
.
should_not_receive
(
:note_issue_email
)
Notify
.
should_not_receive
(
:note_issue_email
)
notification
.
new_note
(
mentioned_note
)
notification
.
new_note
(
mentioned_note
)
end
end
end
def
should_email
(
user_id
)
describe
'new note on issue in project that belongs to a group'
do
Notify
.
should_receive
(
:note_issue_email
).
with
(
user_id
,
note
.
id
)
let
(
:group
)
{
create
(
:group
)
}
before
do
note
.
project
.
namespace_id
=
group
.
id
note
.
project
.
group
.
add_user
(
@u_watcher
,
UsersGroup
::
MASTER
)
note
.
project
.
save
user_project
=
note
.
project
.
users_projects
.
find_by_user_id
(
@u_watcher
.
id
)
user_project
.
notification_level
=
Notification
::
N_PARTICIPATING
user_project
.
save
user_group
=
note
.
project
.
group
.
users_groups
.
find_by_user_id
(
@u_watcher
.
id
)
user_group
.
notification_level
=
Notification
::
N_GLOBAL
user_group
.
save
end
end
def
should_not_email
(
user_id
)
it
do
Notify
.
should_not_receive
(
:note_issue_email
).
with
(
user_id
,
note
.
id
)
should_email
(
note
.
noteable
.
author_id
)
should_email
(
note
.
noteable
.
assignee_id
)
should_email
(
@u_mentioned
.
id
)
should_not_email
(
@u_watcher
.
id
)
should_not_email
(
note
.
author_id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
new_note
(
note
)
end
end
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
end
context
'commit note'
do
context
'commit note'
do
...
...
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