summaryrefslogtreecommitdiff
path: root/spec/helpers/avatars_helper_spec.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-23 09:43:34 +0100
committerToon Claes <toon@gitlab.com>2017-03-23 22:21:00 +0100
commit0759db802f053e2757d52a284fd29098a9473df2 (patch)
tree7a86a3d8fd10d7fda7f7581a194133d57970358d /spec/helpers/avatars_helper_spec.rb
parenta57890bcaa76d540aa675e0c89d50620c9d69018 (diff)
downloadgitlab-ce-0759db802f053e2757d52a284fd29098a9473df2.tar.gz
Move user_link to generic UsersHelper
Make the user_link helper more generic to be used for objects other than pipelines.
Diffstat (limited to 'spec/helpers/avatars_helper_spec.rb')
-rw-r--r--spec/helpers/avatars_helper_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb
new file mode 100644
index 00000000000..581726c1d0e
--- /dev/null
+++ b/spec/helpers/avatars_helper_spec.rb
@@ -0,0 +1,21 @@
+require 'rails_helper'
+
+describe AvatarsHelper do
+ let(:user) { create(:user) }
+
+ describe '#user_avatar' do
+ subject { helper.user_avatar(user: user) }
+
+ 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(16)))
+ end
+ end
+end