diff options
author | Toon Claes <toon@gitlab.com> | 2017-03-20 22:53:14 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-03-22 23:26:29 +0300 |
commit | a57890bcaa76d540aa675e0c89d50620c9d69018 (patch) | |
tree | 090ffa5c59e6db383b4dffbff10e426ccdee2567 /spec | |
parent | e2d5818ee1baa154474124ccc15ad3a29635f1ea (diff) |
Add helpers for pipeline user link & user avatar
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/commits_spec.rb | 1 | ||||
-rw-r--r-- | spec/helpers/pipelines_helper_spec.rb | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 86a00401088..881f1fca4d1 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -12,6 +12,7 @@ describe 'Commits' do end let(:creator) { create(:user) } + let!(:pipeline) do create(:ci_pipeline, project: project, diff --git a/spec/helpers/pipelines_helper_spec.rb b/spec/helpers/pipelines_helper_spec.rb new file mode 100644 index 00000000000..8101fb71ee8 --- /dev/null +++ b/spec/helpers/pipelines_helper_spec.rb @@ -0,0 +1,35 @@ +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 |