summaryrefslogtreecommitdiff
path: root/spec
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
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')
-rw-r--r--spec/helpers/avatars_helper_spec.rb21
-rw-r--r--spec/helpers/pipelines_helper_spec.rb35
-rw-r--r--spec/helpers/users_helper_spec.rb17
3 files changed, 38 insertions, 35 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
diff --git a/spec/helpers/pipelines_helper_spec.rb b/spec/helpers/pipelines_helper_spec.rb
deleted file mode 100644
index 8101fb71ee8..00000000000
--- a/spec/helpers/pipelines_helper_spec.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-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
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
new file mode 100644
index 00000000000..03f78de8e91
--- /dev/null
+++ b/spec/helpers/users_helper_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+describe UsersHelper do
+ let(:user) { create(:user) }
+
+ describe '#user_link' do
+ subject { helper.user_link(user) }
+
+ 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