mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
29 lines
982 B
Ruby
29 lines
982 B
Ruby
require_relative '../environment.rb'
|
|
|
|
describe ArchiveWorker do
|
|
it 'stores an IPFS archive' do
|
|
return if ENV['CI']
|
|
site = Fabricate :site
|
|
ipfs_hash = site.add_to_ipfs
|
|
ArchiveWorker.new.perform site.id
|
|
_(site.archives.length).must_equal 1
|
|
archive_one = site.archives.first
|
|
_(archive_one.ipfs_hash).wont_be_nil
|
|
_(archive_one.ipfs_hash).must_equal ipfs_hash
|
|
_(archive_one.updated_at).wont_be_nil
|
|
|
|
new_updated_at = Time.now - 500
|
|
archive_one.update updated_at: new_updated_at
|
|
|
|
ArchiveWorker.new.perform site.id
|
|
_(archive_one.reload.updated_at).wont_equal new_updated_at
|
|
|
|
site.store_files [{filename: 'test.jpg', tempfile: Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')}]
|
|
ArchiveWorker.new.perform site.id
|
|
|
|
site.reload
|
|
_(site.archives.length).must_equal 2
|
|
archive_two = site.archives_dataset.exclude(ipfs_hash: archive_one.ipfs_hash).first
|
|
_(archive_two.ipfs_hash).wont_be_nil
|
|
end
|
|
end
|