DEV: Split max decompressed setting for themes and backups (#8179)

This commit is contained in:
Roman Rizzi
2019-10-11 14:38:10 -03:00
committed by GitHub
parent f63db1c4c8
commit 01bc465db8
8 changed files with 47 additions and 14 deletions

View File

@ -3,6 +3,8 @@
require 'rails_helper'
describe Compression::Engine do
let(:available_size) { SiteSetting.decompressed_theme_max_file_size_mb }
before do
@temp_folder = "#{Pathname.new(Dir.tmpdir).realpath}/#{SecureRandom.hex}"
@folder_name = 'test'
@ -36,7 +38,7 @@ describe Compression::Engine do
it 'decompress the folder and inspect files correctly' do
engine = described_class.engine_for(@compressed_path)
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.zip")
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.zip", available_size)
expect(read_file("test/hello.txt")).to eq("hello world")
expect(read_file("test/a/inner")).to eq("hello world inner")
@ -49,7 +51,7 @@ describe Compression::Engine do
it 'decompress the folder and inspect files correctly' do
engine = described_class.engine_for(@compressed_path)
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.tar.gz")
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.tar.gz", available_size)
expect(read_file("test/hello.txt")).to eq("hello world")
expect(read_file("test/a/inner")).to eq("hello world inner")
@ -62,7 +64,7 @@ describe Compression::Engine do
it 'decompress the folder and inspect files correctly' do
engine = described_class.engine_for(@compressed_path)
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.tar")
engine.decompress(@temp_folder, "#{@temp_folder}/#{@folder_name}.tar", available_size)
expect(read_file("test/hello.txt")).to eq("hello world")
expect(read_file("test/a/inner")).to eq("hello world inner")