diff options
author | James Lopez <james@jameslopez.es> | 2018-09-10 18:41:51 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-09-10 18:41:51 +0300 |
commit | 78cd19631a5e02d30c22944a201d7074a3653ccf (patch) | |
tree | 0237cf6f459f5d79f81e92fb957a3e7c8f605d9f | |
parent | fab15563963029c9f067d11d3d43fe3e6fac09a1 (diff) |
fix avatar uploader error
-rw-r--r-- | app/uploaders/avatar_uploader.rb | 2 | ||||
-rw-r--r-- | spec/uploaders/avatar_uploader_spec.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index 8526bc16390..c0165759203 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -19,7 +19,7 @@ class AvatarUploader < GitlabUploader end def absolute_path - self.class.absolute_path(model.avatar) + self.class.absolute_path(model.avatar.upload) end private diff --git a/spec/uploaders/avatar_uploader_spec.rb b/spec/uploaders/avatar_uploader_spec.rb index b0468bc35ff..6aaec7a4fef 100644 --- a/spec/uploaders/avatar_uploader_spec.rb +++ b/spec/uploaders/avatar_uploader_spec.rb @@ -35,5 +35,13 @@ describe AvatarUploader do it_behaves_like "migrates", to_store: described_class::Store::REMOTE it_behaves_like "migrates", from_store: described_class::Store::REMOTE, to_store: described_class::Store::LOCAL + + it 'sets the right absolute path' do + storage_path = Gitlab.config.uploads.storage_path + absolute_path = File.join(storage_path, upload.path) + + expect(uploader.absolute_path.scan(storage_path).size).to eq(1) + expect(uploader.absolute_path).to eq(absolute_path) + end end end |