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
6b17c467
Commit
6b17c467
authored
Feb 27, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make some examples faster in NotificationService specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
da9e55a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+15
-16
spec/support/helpers/notification_helpers.rb
spec/support/helpers/notification_helpers.rb
+1
-1
No files found.
spec/services/notification_service_spec.rb
View file @
6b17c467
...
...
@@ -394,7 +394,7 @@ describe NotificationService, :mailer do
end
end
context
'confidential issue note'
,
:deliver_mails_inline
do
context
'confidential issue note'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
...
...
@@ -406,23 +406,22 @@ describe NotificationService, :mailer do
let
(
:note
)
{
create
(
:note_on_issue
,
noteable:
confidential_issue
,
project:
project
,
note:
"
#{
author
.
to_reference
}
#{
assignee
.
to_reference
}
#{
non_member
.
to_reference
}
#{
member
.
to_reference
}
#{
admin
.
to_reference
}
"
)
}
let
(
:guest_watcher
)
{
create_user_with_notification
(
:watch
,
"guest-watcher-confidential"
)
}
it
'filters out users that can not read the issue'
do
subject
{
notification
.
new_note
(
note
)
}
before
do
project
.
add_developer
(
member
)
project
.
add_guest
(
guest
)
expect
(
SentNotification
).
to
receive
(
:record
).
with
(
confidential_issue
,
any_args
).
exactly
(
4
).
times
reset_delivered_emails!
end
notification
.
new_note
(
note
)
it
'filters out users that can not read the issue'
do
subject
should_not_email
(
non_member
)
should_not_email
(
guest
)
should_not_email
(
guest_watcher
)
should_email
(
author
)
should_email
(
assignee
)
should_email
(
member
)
should_email
(
admin
)
expect_delivery_jobs_count
(
4
)
expect_enqueud_email
(
author
.
id
,
note
.
id
,
"mentioned"
,
mail:
"note_issue_email"
)
expect_enqueud_email
(
assignee
.
id
,
note
.
id
,
"mentioned"
,
mail:
"note_issue_email"
)
expect_enqueud_email
(
member
.
id
,
note
.
id
,
"mentioned"
,
mail:
"note_issue_email"
)
expect_enqueud_email
(
admin
.
id
,
note
.
id
,
"mentioned"
,
mail:
"note_issue_email"
)
end
context
'on project that belongs to subgroup'
do
...
...
@@ -442,10 +441,10 @@ describe NotificationService, :mailer do
end
it
'does not email guest user'
do
notification
.
new_note
(
note
)
subject
should_email
(
group_reporter
)
should_not_email
(
group_guest
)
expect_enqueud_email
(
group_reporter
.
id
,
note
.
id
,
nil
,
mail:
"note_issue_email"
)
expect_not_enqueud_email
(
group_guest
.
id
,
"mentioned"
,
mail:
"note_issue_email"
)
end
end
end
...
...
spec/support/helpers/notification_helpers.rb
View file @
6b17c467
...
...
@@ -57,7 +57,7 @@ module NotificationHelpers
expect
(
ActionMailer
::
DeliveryJob
).
to
have_been_enqueued
.
with
(
mailer
,
mail
,
delivery
,
*
args
)
end
def
expect_not_enqueud_email
(
*
args
,
mailer:
"Notify"
,
mail:
""
,
delivery:
"deliver_now"
)
def
expect_not_enqueud_email
(
*
args
,
mailer:
"Notify"
,
mail:
""
)
expect
(
ActionMailer
::
DeliveryJob
).
not_to
have_been_enqueued
.
with
(
mailer
,
mail
,
*
args
,
any_args
)
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