mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix for cache purge rename
This commit is contained in:
parent
f7341f5a51
commit
b0bb40fe23
2 changed files with 14 additions and 0 deletions
|
@ -116,6 +116,9 @@ class SiteFile < Sequel::Model
|
|||
site.purge_cache site_file.path
|
||||
site.purge_cache original_site_file_path
|
||||
end
|
||||
else
|
||||
site.purge_cache new_path
|
||||
site.purge_cache current_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,6 +29,17 @@ describe 'site_files' do
|
|||
PurgeCacheWorker.jobs.clear
|
||||
end
|
||||
|
||||
it 'works with html file' do
|
||||
uploaded_file = Rack::Test::UploadedFile.new('./tests/files/notindex.html', 'text/html')
|
||||
upload 'files[]' => uploaded_file
|
||||
PurgeCacheWorker.jobs.clear
|
||||
testfile = @site.site_files_dataset.where(path: 'notindex.html').first
|
||||
testfile.rename 'notindex2.html'
|
||||
_(PurgeCacheWorker.jobs.length).must_equal 2
|
||||
_(PurgeCacheWorker.jobs.collect {|p| p['args'].last}.sort).must_equal ["/notindex", "/notindex2"]
|
||||
end
|
||||
|
||||
|
||||
it 'renames in same path' do
|
||||
uploaded_file = Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||
upload 'files[]' => uploaded_file
|
||||
|
|
Loading…
Add table
Reference in a new issue