mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 23:19:25 +08:00
FIX: Heisentest
We use the `id` of the upload to calculate a `depth` partition in the filename. This test would fail if your database had a higher seed because the depth it was looking for was hard coded to 1. The solution was to not save the records (which is faster anyway) and specify the `id` of the upload to make the hash deterministic.
This commit is contained in:
parent
16a7102dad
commit
bee68bba2e
@ -21,16 +21,16 @@ RSpec.describe FileStore::BaseStore do
|
||||
end
|
||||
|
||||
describe '#get_path_for_optimized_image' do
|
||||
let(:upload) { Fabricate(:upload) }
|
||||
let(:upload) { Fabricate.build(:upload, id: 100) }
|
||||
let(:optimized_path) { "optimized/1X/#{upload.sha1}_1_100x200.png" }
|
||||
|
||||
it 'should return the right path' do
|
||||
optimized = Fabricate(:optimized_image, upload: upload, version: 1)
|
||||
optimized = Fabricate.build(:optimized_image, upload: upload, version: 1)
|
||||
expect(FileStore::BaseStore.new.get_path_for_optimized_image(optimized)).to eq(optimized_path)
|
||||
end
|
||||
|
||||
it 'should return the right path for `nil` version' do
|
||||
optimized = Fabricate(:optimized_image, upload: upload, version: nil)
|
||||
optimized = Fabricate.build(:optimized_image, upload: upload, version: nil)
|
||||
expect(FileStore::BaseStore.new.get_path_for_optimized_image(optimized)).to eq(optimized_path)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user