diff options
author | Micaƫl Bergeron <mbergeron@gitlab.com> | 2018-04-23 16:59:53 +0000 |
---|---|---|
committer | John Northrup <john@gitlab.com> | 2018-04-23 16:59:53 +0000 |
commit | 741f333d23cd09de328c9f4035c16210cb97aa10 (patch) | |
tree | 7d7d064ad4b16848bd82a1c26876e5a4292151a3 /spec/models/concerns/avatarable_spec.rb | |
parent | c0eabb84f57aed587589839136dadff01836e888 (diff) | |
download | gitlab-ce-741f333d23cd09de328c9f4035c16210cb97aa10.tar.gz |
Resolve "Avatar URLs are wrong when using a CDN path and Object Storage"
Diffstat (limited to 'spec/models/concerns/avatarable_spec.rb')
-rw-r--r-- | spec/models/concerns/avatarable_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/models/concerns/avatarable_spec.rb b/spec/models/concerns/avatarable_spec.rb index 3696e6f62fd..9faf21bfbbd 100644 --- a/spec/models/concerns/avatarable_spec.rb +++ b/spec/models/concerns/avatarable_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Avatarable do - set(:project) { create(:project, avatar: fixture_file_upload(File.join(Rails.root, 'spec/fixtures/dk.png'))) } + let(:project) { create(:project, :with_avatar) } let(:gitlab_host) { "https://gitlab.example.com" } let(:relative_url_root) { "/gitlab" } @@ -37,11 +37,23 @@ describe Avatarable do project.visibility_level = visibility_level end - let(:avatar_path) { (avatar_path_prefix + [project.avatar.url]).join } + let(:avatar_path) { (avatar_path_prefix + [project.avatar.local_url]).join } it 'returns the expected avatar path' do expect(project.avatar_path(only_path: only_path)).to eq(avatar_path) end + + context "when avatar is stored remotely" do + before do + stub_uploads_object_storage(AvatarUploader) + + project.avatar.migrate!(ObjectStorage::Store::REMOTE) + end + + it 'returns the expected avatar path' do + expect(project.avatar_url(only_path: only_path)).to eq(avatar_path) + end + end end end end |