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:
Diffstat (limited to 'spec/helpers/avatars_helper_spec.rb')
-rw-r--r--spec/helpers/avatars_helper_spec.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb
index 120dbe7cb49..047a6ca0b7d 100644
--- a/spec/helpers/avatars_helper_spec.rb
+++ b/spec/helpers/avatars_helper_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe AvatarsHelper do
shared_examples 'resource with a default avatar' do |source_type|
it 'returns a default avatar div' do
expect(public_send("#{source_type}_icon", *helper_args))
- .to match(%r{<div class="identicon bg\d+">F</div>})
+ .to match(%r{<span class="identicon bg\d+">F</span>})
end
end
@@ -409,4 +409,33 @@ RSpec.describe AvatarsHelper do
end
end
end
+
+ describe '#avatar_without_link' do
+ let(:options) { { size: 32 } }
+
+ subject { helper.avatar_without_link(resource, options) }
+
+ context 'with users' do
+ let(:resource) { user }
+
+ it 'displays user avatar' do
+ is_expected.to eq tag(
+ :img,
+ alt: "#{user.name}'s avatar",
+ src: avatar_icon_for_user(user, 32),
+ data: { container: 'body' },
+ class: 'avatar s32 has-tooltip',
+ title: user.name
+ )
+ end
+ end
+
+ context 'with groups' do
+ let(:resource) { build_stubbed(:group, name: 'foo') }
+
+ it 'displays group avatar' do
+ is_expected.to match(%r{<span class="avatar identicon bg\d+ s32">F</span>})
+ end
+ end
+ end
end