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
5ea33f64
Commit
5ea33f64
authored
Aug 26, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up notification service specs
parent
028bfb11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
27 deletions
+38
-27
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+38
-27
No files found.
spec/services/notification_service_spec.rb
View file @
5ea33f64
...
...
@@ -286,10 +286,10 @@ RSpec.describe NotificationService, :mailer do
describe
'Notes'
do
context
'issue note'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
assignee
])
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignees:
issue
.
assignees
)
}
let
(
:author
)
{
create
(
:user
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:private
)
}
let
_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
assignee
])
}
let
_it_be
(
:mentioned_issue
)
{
create
(
:issue
,
assignees:
issue
.
assignees
)
}
let
_it_be_with_reload
(
:author
)
{
create
(
:user
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
author:
author
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@mention referenced, @unsubscribed_mentioned and @outsider also'
)
}
subject
{
notification
.
new_note
(
note
)
}
...
...
@@ -368,7 +368,7 @@ RSpec.describe NotificationService, :mailer do
end
describe
'#new_note'
do
before
do
before
_all
do
build_team
(
project
)
project
.
add_maintainer
(
issue
.
author
)
project
.
add_maintainer
(
assignee
)
...
...
@@ -390,9 +390,12 @@ RSpec.describe NotificationService, :mailer do
end
context
'with users'
do
before
do
before
_all
do
add_users
(
project
)
add_user_subscriptions
(
issue
)
end
before
do
reset_delivered_emails!
end
...
...
@@ -569,17 +572,20 @@ RSpec.describe NotificationService, :mailer do
end
context
'issue note mention'
,
:deliver_mails_inline
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
assignee
])
}
let
(
:mentioned_issue
)
{
create
(
:issue
,
assignees:
issue
.
assignees
)
}
let
(
:author
)
{
create
(
:user
)
}
let
_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignees:
[
assignee
])
}
let
_it_be
(
:mentioned_issue
)
{
create
(
:issue
,
assignees:
issue
.
assignees
)
}
let
_it_be
(
:author
)
{
create
(
:user
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
author:
author
,
noteable:
issue
,
project_id:
issue
.
project_id
,
note:
'@all mentioned'
)
}
before
do
before
_all
do
build_team
(
project
)
build_group
(
project
)
add_users
(
project
)
add_user_subscriptions
(
issue
)
project
.
add_maintainer
(
author
)
end
before
do
reset_delivered_emails!
end
...
...
@@ -726,18 +732,21 @@ RSpec.describe NotificationService, :mailer do
end
context
'commit note'
,
:deliver_mails_inline
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
_it_be
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
before
do
before
_all
do
build_team
(
project
)
build_group
(
project
)
reset_delivered_emails!
allow
(
note
.
noteable
).
to
receive
(
:author
).
and_return
(
@u_committer
)
update_custom_notification
(
:new_note
,
@u_guest_custom
,
resource:
project
)
update_custom_notification
(
:new_note
,
@u_custom_global
)
end
before
do
reset_delivered_emails!
allow
(
note
.
noteable
).
to
receive
(
:author
).
and_return
(
@u_committer
)
end
describe
'#new_note, #perform_enqueued_jobs'
do
it
do
notification
.
new_note
(
note
)
...
...
@@ -785,12 +794,12 @@ RSpec.describe NotificationService, :mailer do
end
context
"merge request diff note"
,
:deliver_mails_inline
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
assignees:
[
user
],
author:
create
(
:user
))
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
assignees:
[
user
],
author:
create
(
:user
))
}
let
_it_be
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
noteable:
merge_request
)
}
before
do
before
_all
do
build_team
(
note
.
project
)
project
.
add_maintainer
(
merge_request
.
author
)
merge_request
.
assignees
.
each
{
|
assignee
|
project
.
add_maintainer
(
assignee
)
}
...
...
@@ -2521,15 +2530,15 @@ RSpec.describe NotificationService, :mailer do
describe
'Pipelines'
,
:deliver_mails_inline
do
describe
'#pipeline_finished'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:u_member
)
{
create
(
:user
)
}
let
(
:u_watcher
)
{
create_user_with_notification
(
:watch
,
'watcher'
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
_it_be
(
:u_member
)
{
create
(
:user
)
}
let
_it_be
(
:u_watcher
)
{
create_user_with_notification
(
:watch
,
'watcher'
)
}
let
(
:u_custom_notification_unset
)
do
let
_it_be
(
:u_custom_notification_unset
)
do
create_user_with_notification
(
:custom
,
'custom_unset'
)
end
let
(
:u_custom_notification_enabled
)
do
let
_it_be
(
:u_custom_notification_enabled
)
do
user
=
create_user_with_notification
(
:custom
,
'custom_enabled'
)
update_custom_notification
(
:success_pipeline
,
user
,
resource:
project
)
update_custom_notification
(
:failed_pipeline
,
user
,
resource:
project
)
...
...
@@ -2537,7 +2546,7 @@ RSpec.describe NotificationService, :mailer do
user
end
let
(
:u_custom_notification_disabled
)
do
let
_it_be
(
:u_custom_notification_disabled
)
do
user
=
create_user_with_notification
(
:custom
,
'custom_disabled'
)
update_custom_notification
(
:success_pipeline
,
user
,
resource:
project
,
value:
false
)
update_custom_notification
(
:failed_pipeline
,
user
,
resource:
project
,
value:
false
)
...
...
@@ -2556,13 +2565,15 @@ RSpec.describe NotificationService, :mailer do
before_sha:
'00000000'
)
end
before
do
before
_all
do
project
.
add_maintainer
(
u_member
)
project
.
add_maintainer
(
u_watcher
)
project
.
add_maintainer
(
u_custom_notification_unset
)
project
.
add_maintainer
(
u_custom_notification_enabled
)
project
.
add_maintainer
(
u_custom_notification_disabled
)
end
before
do
reset_delivered_emails!
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