summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-07-16 18:18:52 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-07-30 15:01:26 +0200
commitf1d3ea63cf74d2791a9a863b29ab2d919ea61bd0 (patch)
treec36c2b272fba917af321a4f16c34a5047407f3b2 /spec/views
parentb4c4b48a8c0258ff266c523488aa169a1b5ea0f3 (diff)
downloadgitlab-ce-f1d3ea63cf74d2791a9a863b29ab2d919ea61bd0.tar.gz
Show the status of a user in interactions
The status is shown for - The author of a commit when viewing a commit - Notes on a commit (regular/diff) - The user that triggered a pipeline when viewing a pipeline - The author of a merge request when viewing a merge request - The author of notes on a merge request (regular/diff) - The author of an issue when viewing an issue - The author of notes on an issue - The author of a snippet when viewing a snippet - The author of notes on a snippet - A user's profile page - The list of members of a group/user
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/merge_requests/show.html.haml_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/views/projects/merge_requests/show.html.haml_spec.rb b/spec/views/projects/merge_requests/show.html.haml_spec.rb
index fe6ad26a6f6..fa6c4ce4ac8 100644
--- a/spec/views/projects/merge_requests/show.html.haml_spec.rb
+++ b/spec/views/projects/merge_requests/show.html.haml_spec.rb
@@ -17,6 +17,13 @@ describe 'projects/merge_requests/show.html.haml' do
author: user)
end
+ def preload_view_requirements
+ # This will load the status fields of the author of the note and merge request
+ # to avoid queries in when rendering the view being tested.
+ closed_merge_request.author.status
+ note.author.status
+ end
+
before do
assign(:project, project)
assign(:merge_request, closed_merge_request)
@@ -26,6 +33,8 @@ describe 'projects/merge_requests/show.html.haml' do
assign(:notes, [])
assign(:pipelines, Ci::Pipeline.none)
+ preload_view_requirements
+
allow(view).to receive_messages(current_user: user,
can?: true,
current_application_settings: Gitlab::CurrentSettings.current_application_settings)
@@ -42,6 +51,7 @@ describe 'projects/merge_requests/show.html.haml' do
it 'does not show the "Reopen" button when the source project does not exist' do
unlink_project.execute
closed_merge_request.reload
+ preload_view_requirements
render
@@ -56,6 +66,7 @@ describe 'projects/merge_requests/show.html.haml' do
forked_project.destroy
# Reload merge request so MergeRequest#source_project turns to `nil`
closed_merge_request.reload
+ preload_view_requirements
render