2017-01-05 12:46:32 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Projects::ParticipantsService do
|
2017-01-05 12:46:32 -05:00
|
|
|
describe '#groups' do
|
|
|
|
describe 'avatar_url' do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :public) }
|
2018-06-05 17:18:06 -04:00
|
|
|
let(:group) { create(:group, avatar: fixture_file_upload('spec/fixtures/dk.png')) }
|
2017-01-05 12:46:32 -05:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
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
|
2017-07-17 09:46:59 -04:00
|
|
|
expect(groups.first[:avatar_url]).to eq("/uploads/-/system/group/avatar/#{group.id}/dk.png")
|
2017-01-05 12:46:32 -05:00
|
|
|
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
|
2017-07-17 09:46:59 -04:00
|
|
|
expect(groups.first[:avatar_url]).to eq("/gitlab/uploads/-/system/group/avatar/#{group.id}/dk.png")
|
2017-01-05 12:46:32 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|