Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhogewest <hogewest@gmail.com>2017-01-05 20:46:32 +0300
committerhogewest <hogewest@gmail.com>2017-01-05 23:18:29 +0300
commitc1d235418f9167ac70af1bafa592a36c2f9ed777 (patch)
tree34372207c6a9280f8ba231fab7374541f08d6c88 /spec/services/projects
parentcd85baf5e363847ee1cca2e154e5fb47484e0fdf (diff)
Fix broken url on group avatar
Diffstat (limited to 'spec/services/projects')
-rw-r--r--spec/services/projects/participants_service_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/services/projects/participants_service_spec.rb b/spec/services/projects/participants_service_spec.rb
new file mode 100644
index 00000000000..063b3bd76eb
--- /dev/null
+++ b/spec/services/projects/participants_service_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe Projects::ParticipantsService, services: true do
+ describe '#groups' do
+ describe 'avatar_url' do
+ let(:project) { create(:empty_project, :public) }
+ let(:group) { create(:group, avatar: fixture_file_upload(Rails.root + 'spec/fixtures/dk.png')) }
+ let(:user) { create(:user) }
+ let(:base_url) { Settings.send(:build_base_gitlab_url) }
+ let!(:group_member) { create(:group_member, group: group, user: user) }
+
+ it 'should return an url for the avatar' do
+ participants = described_class.new(project, user)
+ groups = participants.groups
+
+ expect(groups.size).to eq 1
+ expect(groups.first[:avatar_url]).to eq "#{base_url}/uploads/group/avatar/#{group.id}/dk.png"
+ end
+
+ it 'should return an url for the avatar with relative url' do
+ stub_config_setting(relative_url_root: '/gitlab')
+ stub_config_setting(url: Settings.send(:build_gitlab_url))
+
+ participants = described_class.new(project, user)
+ groups = participants.groups
+
+ expect(groups.size).to eq 1
+ expect(groups.first[:avatar_url]).to eq "#{base_url}/gitlab/uploads/group/avatar/#{group.id}/dk.png"
+ end
+ end
+ end
+end