mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 16:02:46 +08:00
FIX: Tests would fail if your test db's optimized image ids were high
This commit is contained in:
parent
9e01a7d834
commit
f155ff8270
|
@ -71,8 +71,12 @@ module FileStore
|
|||
def purge_tombstone(grace_period)
|
||||
end
|
||||
|
||||
def get_depth_for(id)
|
||||
[0, Math.log(id / 1_000.0, 16).ceil].max
|
||||
end
|
||||
|
||||
def get_path_for(type, id, sha, extension)
|
||||
depth = [0, Math.log(id / 1_000.0, 16).ceil].max
|
||||
depth = get_depth_for(id)
|
||||
tree = File.join(*sha[0, depth].split(""), "")
|
||||
"#{type}/#{depth + 1}X/#{tree}#{sha}#{extension}"
|
||||
end
|
||||
|
|
|
@ -114,6 +114,8 @@ describe CookedPostProcessor do
|
|||
|
||||
# hmmm this should be done in a cleaner way
|
||||
OptimizedImage.expects(:resize).returns(true)
|
||||
|
||||
FileStore::BaseStore.any_instance.expects(:get_depth_for).returns(0)
|
||||
end
|
||||
|
||||
it "generates overlay information" do
|
||||
|
@ -141,6 +143,7 @@ describe CookedPostProcessor do
|
|||
|
||||
# hmmm this should be done in a cleaner way
|
||||
OptimizedImage.expects(:resize).returns(true)
|
||||
FileStore::BaseStore.any_instance.expects(:get_depth_for).returns(0)
|
||||
end
|
||||
|
||||
it "generates overlay information" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user