diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-16 12:26:48 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-16 12:26:48 +0300 |
commit | 34148d15764898579cc44ea02f439e8359e01233 (patch) | |
tree | f390aff9f58f2f26fab1c99915c9dd73babe6ea0 /spec/helpers | |
parent | 95f0440a7823a927ebba1557b091c12255e49ac4 (diff) | |
parent | bd3689e9e0aebe43f7c5f787e03a3bbaa8b2ef68 (diff) |
Merge branch 'master' into rs-redactor-filter
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 9 | ||||
-rw-r--r-- | spec/helpers/projects_helper_spec.rb | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 742420f550e..1dfae0fbd3f 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -99,6 +99,15 @@ describe ApplicationHelper do helper.avatar_icon('foo@example.com', 20) end + + describe 'using a User' do + it 'should return an URL for the avatar' do + user = create(:user, avatar: File.open(avatar_file_path)) + + expect(helper.avatar_icon(user).to_s). + to match("/uploads/user/avatar/#{user.id}/banana_sample.gif") + end + end end describe 'gravatar_icon' do diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 53e56ebff44..f2efb528aeb 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -70,4 +70,18 @@ describe ProjectsHelper do expect(helper.send(:readme_cache_key)).to eq("#{project.path_with_namespace}-nil-readme") end end + + describe 'link_to_member' do + let(:group) { create(:group) } + let(:project) { create(:empty_project, group: group) } + let(:user) { create(:user) } + + describe 'using the default options' do + it 'returns an HTML link to the user' do + link = helper.link_to_member(project, user) + + expect(link).to match(%r{/u/#{user.username}}) + end + end + end end |