fix avatar uploader error

This commit is contained in:
James Lopez 2018-09-10 17:41:51 +02:00
parent fab1556396
commit 78cd19631a
No known key found for this signature in database
GPG Key ID: 756BF8E9D7C0CF39
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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