Skip to content
Snippets Groups Projects
Commit f1d3ea63 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

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
parent b4c4b48a
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
# frozen_string_literal: true
RSpec::Matchers.define :show_user_status do |status|
match do |page|
expect(page).to have_selector(".user-status-emoji[title='#{status.message}']")
# The same user status might be displayed multiple times on the page
emoji_span = page.first(".user-status-emoji[title='#{status.message}']")
page.within(emoji_span) do
expect(page).to have_emoji(status.emoji)
end
end
end
# frozen_string_literal: true
shared_examples 'showing user status' do
let!(:status) { create(:user_status, user: user_with_status, emoji: 'smirk', message: 'Authoring this object') }
it 'shows the status' do
subject
expect(page).to show_user_status(status)
end
end
Loading
Loading
@@ -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)
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment