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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
03fb2a56
Commit
03fb2a56
authored
Mar 29, 2017
by
http://jneen.net/
Committed by
Felipe Artur
Apr 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a spec for EE::NotificationService
parent
4caf802d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
spec/services/ee/notification_service_spec.rb
spec/services/ee/notification_service_spec.rb
+72
-0
No files found.
spec/services/ee/notification_service_spec.rb
0 → 100644
View file @
03fb2a56
require
'spec_helper'
describe
EE
::
NotificationService
do
let
(
:subject
)
{
NotificationService
.
new
}
def
should_email!
expect
(
Notify
).
to
receive
(
:service_desk_new_note_email
).
with
(
issue
.
id
,
instance_of
(
Fixnum
))
end
def
should_not_email!
expect
(
Notify
).
not_to
receive
(
:service_desk_new_note_email
)
end
def
execute!
subject
.
send_service_desk_notification
(
note
)
end
def
self
.
it_should_email!
it
'sends the email'
do
should_email!
execute!
end
end
def
self
.
it_should_not_email!
it
'doesn\'t send the email'
do
should_not_email!
execute!
end
end
let
(
:issue
)
{
create
(
:issue
,
author:
User
.
support_bot
)
}
let
(
:project
)
{
issue
.
project
}
let
(
:note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
)
}
context
'a non-service-desk issue'
do
it_should_not_email!
end
context
'a service-desk issue'
do
before
do
issue
.
update!
(
service_desk_reply_to:
'service.desk@example.com'
)
project
.
update!
(
service_desk_enabled:
true
)
end
it_should_email!
context
'where the project has disabled the feature'
do
before
do
project
.
update
(
service_desk_enabled:
false
)
end
it_should_not_email!
end
context
'when the license doesn\'t allow service desk'
do
before
do
expect
(
Gitlab
::
EE
::
ServiceDesk
).
to
receive
(
:enabled?
).
and_return
(
false
)
end
it_should_not_email!
end
context
'when the support bot has unsubscribed'
do
before
do
issue
.
unsubscribe
(
User
.
support_bot
,
project
)
end
it_should_not_email!
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