diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-01-05 22:50:52 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-01-05 22:50:52 +0300 |
commit | a298f694327b1241fc0d06618228e3750c20c5a1 (patch) | |
tree | d327b258ecffa12dc7da908cf6966a527f859121 /spec/helpers/page_layout_helper_spec.rb | |
parent | 7a3b76297873782e2a56e77bcf55bbe950e57453 (diff) |
Use `User#avatar_url` instead of `avatar_icon` helper
Diffstat (limited to 'spec/helpers/page_layout_helper_spec.rb')
-rw-r--r-- | spec/helpers/page_layout_helper_spec.rb | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb index 300dccf50ec..83aeafcf31a 100644 --- a/spec/helpers/page_layout_helper_spec.rb +++ b/spec/helpers/page_layout_helper_spec.rb @@ -70,46 +70,27 @@ describe PageLayoutHelper do expect(helper.page_image).to end_with 'assets/gitlab_logo.png' end - context 'with @project' do - it 'uses Project avatar if available' do - project = double(avatar_url: 'http://example.com/uploads/avatar.png') - assign(:project, project) + %w(project user group).each do |type| + context "with @#{type} assigned" do + it "uses #{type.titlecase} avatar if available" do + object = double(avatar_url: 'http://example.com/uploads/avatar.png') + assign(type, object) - expect(helper.page_image).to eq project.avatar_url - end - - it 'falls back to the default' do - project = double(avatar_url: nil) - assign(:project, project) - - expect(helper.page_image).to end_with 'assets/gitlab_logo.png' - end - end - - context 'with @user' do - it 'delegates to avatar_icon helper' do - user = double('User') - assign(:user, user) + expect(helper.page_image).to eq object.avatar_url + end - expect(helper).to receive(:avatar_icon).with(user) + it 'falls back to the default when avatar_url is nil' do + object = double(avatar_url: nil) + assign(type, object) - helper.page_image + expect(helper.page_image).to end_with 'assets/gitlab_logo.png' + end end - end - - context 'with @group' do - it 'uses Group avatar if available' do - group = double(avatar_url: 'http://example.com/uploads/avatar.png') - assign(:group, group) - - expect(helper.page_image).to eq group.avatar_url - end - - it 'falls back to the default' do - group = double(avatar_url: nil) - assign(:group, group) - expect(helper.page_image).to end_with 'assets/gitlab_logo.png' + context "with no assignments" do + it 'falls back to the default' do + expect(helper.page_image).to end_with 'assets/gitlab_logo.png' + end end end end |