Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Hall <jessehall3@gmail.com>2019-08-30 20:26:10 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-08-30 20:26:10 +0300
commit05a37f69e13250abe291b39f5a5f8926a717b5e6 (patch)
tree3c87370ea30c98ac0c7bf2af6d759a615c9ead9b /spec/helpers
parent0fa2ea2e5a7af50a3394645590e829499591b48a (diff)
Fix for #56295, https://gitlab.com/gitlab-org/gitlab-ce/issues/56295.
All avatars now visible in commit trailers.
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/avatars_helper_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb
index 94998d302f9..6fbb6147d84 100644
--- a/spec/helpers/avatars_helper_spec.rb
+++ b/spec/helpers/avatars_helper_spec.rb
@@ -324,5 +324,47 @@ describe AvatarsHelper do
)
end
end
+
+ context 'with only_path parameter set to false' do
+ let(:user_with_avatar) { create(:user, :with_avatar, username: 'foobar') }
+
+ context 'with user parameter' do
+ let(:options) { { user: user_with_avatar, only_path: false } }
+
+ it 'will return avatar with a full path' do
+ is_expected.to eq tag(
+ :img,
+ alt: "#{user_with_avatar.name}'s avatar",
+ src: avatar_icon_for_user(user_with_avatar, 16, only_path: false),
+ data: { container: 'body' },
+ class: "avatar s16 has-tooltip",
+ title: user_with_avatar.name
+ )
+ end
+ end
+
+ context 'with user_name and user_email' do
+ let(:options) { { user_email: user_with_avatar.email, user_name: user_with_avatar.username, only_path: false } }
+
+ it 'will return avatar with a full path' do
+ is_expected.to eq tag(
+ :img,
+ alt: "#{user_with_avatar.username}'s avatar",
+ src: avatar_icon_for_email(user_with_avatar.email, 16, only_path: false),
+ data: { container: 'body' },
+ class: "avatar s16 has-tooltip",
+ title: user_with_avatar.username
+ )
+ end
+ end
+ end
+
+ context 'with unregistered email address' do
+ let(:options) { { user_email: "unregistered_email@example.com" } }
+
+ it 'will return default alt text for avatar' do
+ expect(subject).to include("default avatar")
+ end
+ end
end
end