Commit a57890bc authored by Toon Claes's avatar Toon Claes

Add helpers for pipeline user link & user avatar

parent e2d5818e
module PipelinesHelper
def pipeline_user_avatar(pipeline)
user_avatar(user: pipeline.user, size: 24)
end
def pipeline_user_link(pipeline)
link_to(pipeline.user.name, user_path(pipeline.user),
title: pipeline.user.email,
class: 'has-tooltip commit-committer-link')
end
end
......@@ -5,8 +5,8 @@
triggered #{time_ago_with_tooltip(@pipeline.created_at)}
- if @pipeline.user
by
= user_avatar(user: @pipeline.user, size: 24, css_class: 'hidden-xs')
= link_to(@pipeline.user.name, user_path(@pipeline.user.username), title: @pipeline.user.email, class: 'has-tooltip commit-committer-link')
= pipeline_user_avatar(@pipeline)
= pipeline_user_link(@pipeline)
.header-action-buttons
- if can?(current_user, :update_pipeline, @pipeline.project)
- if @pipeline.retryable?
......
---
title: Show pipeline creator & created_at in heading
title: Show correct user & creation time in heading of the pipeline page
merge_request: 9936
author:
......@@ -12,6 +12,7 @@ describe 'Commits' do
end
let(:creator) { create(:user) }
let!(:pipeline) do
create(:ci_pipeline,
project: project,
......
require 'rails_helper'
describe PipelinesHelper do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id, user: user) }
describe '#pipeline_user_avatar' do
subject { helper.pipeline_user_avatar(pipeline) }
it "links to the user's profile" do
is_expected.to include("href=\"#{user_path(user)}\"")
end
it "has the user's name as title" do
is_expected.to include("title=\"#{user.name}\"")
end
it "contains the user's avatar image" do
is_expected.to include(CGI.escapeHTML(user.avatar_url(24)))
end
end
describe '#pipeline_user_link' do
subject { helper.pipeline_user_link(pipeline) }
it "links to the user's profile" do
is_expected.to include("href=\"#{user_path(user)}\"")
end
it "has the user's email as title" do
is_expected.to include("title=\"#{user.email}\"")
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment