DEV: Fix broken `Upload#base62_sha1`.

This commit is contained in:
Guo Xiang Tan 2019-06-04 14:10:46 +08:00
parent 787ccb5746
commit bb98785569
2 changed files with 8 additions and 1 deletions

View File

@ -138,7 +138,7 @@ class Upload < ActiveRecord::Base
end
def base62_sha1
Upload.base62_sha1(upload.sha1)
Upload.base62_sha1(self.sha1)
end
def local?

View File

@ -253,6 +253,13 @@ describe Upload do
end
end
describe '#base62_sha1' do
it 'should return the right value' do
upload.update!(sha1: "0000c513e1da04f7b4e99230851ea2aafeb8cc4e")
expect(upload.base62_sha1).to eq("1Eg9p8rrCURq4T3a6iJUk0ri6")
end
end
describe '.sha1_from_short_path' do
it "should be able to lookup sha1" do
path = "/uploads/short-url/3UjQ4jHoyeoQndk5y3qHzm3QVTQ.png"