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
c04120c1
Commit
c04120c1
authored
Mar 28, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve notification service tests
parent
f49a2ac0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
11 deletions
+22
-11
app/mailers/emails/issues.rb
app/mailers/emails/issues.rb
+1
-1
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+20
-9
No files found.
app/mailers/emails/issues.rb
View file @
c04120c1
...
@@ -13,7 +13,7 @@ module Emails
...
@@ -13,7 +13,7 @@ module Emails
mail
(
to:
recipient
(
recipient_id
),
subject:
subject
(
"changed issue #
#{
@issue
.
id
}
"
,
@issue
.
title
))
mail
(
to:
recipient
(
recipient_id
),
subject:
subject
(
"changed issue #
#{
@issue
.
id
}
"
,
@issue
.
title
))
end
end
def
close_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
)
def
close
d
_issue_email
(
recipient_id
,
issue_id
,
updated_by_user_id
)
@issue
=
Issue
.
find
issue_id
@issue
=
Issue
.
find
issue_id
@project
=
@issue
.
project
@project
=
@issue
.
project
@updated_by
=
User
.
find
updated_by_user_id
@updated_by
=
User
.
find
updated_by_user_id
...
...
app/services/notification_service.rb
View file @
c04120c1
...
@@ -33,7 +33,7 @@ class NotificationService
...
@@ -33,7 +33,7 @@ class NotificationService
# * project team members with notification level higher then Participating
# * project team members with notification level higher then Participating
#
#
def
close_issue
(
issue
,
current_user
)
def
close_issue
(
issue
,
current_user
)
close_resource_email
(
issue
,
current_user
,
'close_issue_email'
)
close_resource_email
(
issue
,
current_user
,
'close
d
_issue_email'
)
end
end
# When we reassign an issue we should send next emails:
# When we reassign an issue we should send next emails:
...
...
spec/services/notification_service_spec.rb
View file @
c04120c1
...
@@ -28,9 +28,20 @@ describe NotificationService do
...
@@ -28,9 +28,20 @@ describe NotificationService do
end
end
describe
:new_issue
do
describe
:new_issue
do
it
'should sent email to issue assignee'
do
it
do
Notify
.
should_receive
(
:new_issue_email
).
with
(
issue
.
id
)
should_email
(
issue
.
assignee_id
)
notification
.
new_issue
(
issue
,
nil
)
should_email
(
@u_watcher
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
new_issue
(
issue
,
@u_disabled
)
end
def
should_email
(
user_id
)
Notify
.
should_receive
(
:new_issue_email
).
with
(
user_id
,
issue
.
id
)
end
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:new_issue_email
).
with
(
user_id
,
issue
.
id
)
end
end
end
end
...
@@ -65,11 +76,11 @@ describe NotificationService do
...
@@ -65,11 +76,11 @@ describe NotificationService do
end
end
def
should_email
(
user_id
)
def
should_email
(
user_id
)
Notify
.
should_receive
(
:closed_issue_email
).
with
(
user_id
,
issue
.
id
,
issue
.
assignee_
id
)
Notify
.
should_receive
(
:closed_issue_email
).
with
(
user_id
,
issue
.
id
,
@u_disabled
.
id
)
end
end
def
should_not_email
(
user_id
)
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:closed_issue_email
).
with
(
user_id
,
issue
.
id
,
issue
.
assignee_
id
)
Notify
.
should_not_receive
(
:closed_issue_email
).
with
(
user_id
,
issue
.
id
,
@u_disabled
.
id
)
end
end
end
end
end
end
...
@@ -91,11 +102,11 @@ describe NotificationService do
...
@@ -91,11 +102,11 @@ describe NotificationService do
end
end
def
should_email
(
user_id
)
def
should_email
(
user_id
)
Notify
.
should_receive
(
:new_merge_request_email
).
with
(
merge_request
.
id
)
Notify
.
should_receive
(
:new_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
end
end
def
should_not_email
(
user_id
)
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:new_merge_request_email
).
with
(
merge_request
.
id
)
Notify
.
should_not_receive
(
:new_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
end
end
end
end
...
@@ -127,11 +138,11 @@ describe NotificationService do
...
@@ -127,11 +138,11 @@ describe NotificationService do
end
end
def
should_email
(
user_id
)
def
should_email
(
user_id
)
Notify
.
should_receive
(
:closed_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
Notify
.
should_receive
(
:closed_merge_request_email
).
with
(
user_id
,
merge_request
.
id
,
@u_disabled
.
id
)
end
end
def
should_not_email
(
user_id
)
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:closed_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
Notify
.
should_not_receive
(
:closed_merge_request_email
).
with
(
user_id
,
merge_request
.
id
,
@u_disabled
.
id
)
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