mostly finished port to ruby3

This commit is contained in:
Kyle Drake 2022-08-10 14:31:36 -05:00
parent a9dd102383
commit 0ca1473d22
30 changed files with 765 additions and 731 deletions

View file

@ -6,23 +6,23 @@ describe ArchiveWorker do
site = Fabricate :site
ipfs_hash = site.add_to_ipfs
ArchiveWorker.new.perform site.id
site.archives.length.must_equal 1
_(site.archives.length).must_equal 1
archive_one = site.archives.first
archive_one.ipfs_hash.must_equal ipfs_hash
archive_one.updated_at.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
_(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
_(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
_(archive_two.ipfs_hash).wont_be_nil
end
end

View file

@ -15,12 +15,12 @@ describe EmailWorker do
})
mail = Mail::TestMailer.deliveries.first
mail.from.first.must_equal 'from@example.com'
mail.to.first.must_equal 'to@example.com'
mail.subject.must_equal 'Hello World'
_(mail.from.first).must_equal 'from@example.com'
_(mail.to.first).must_equal 'to@example.com'
_(mail.subject).must_equal 'Hello World'
body = mail.body.to_s
body.must_match /testing/
body.must_match /unsubscribe/
_(body).must_match /testing/
_(body).must_match /unsubscribe/
end
it 'sends an email without a footer' do
@ -33,7 +33,7 @@ describe EmailWorker do
'body' => 'testing'
})
body = Mail::TestMailer.deliveries.first.body.to_s
body.must_match /testing/
body.wont_match /unsubscribe/
_(body).must_match /testing/
_(body).wont_match /unsubscribe/
end
end

View file

@ -19,8 +19,8 @@ describe ScreenshotWorker do
ScreenshotWorker.new.perform site.username, path
Site::SCREENSHOT_RESOLUTIONS.each do |r|
File.exists?(File.join(Site::SCREENSHOTS_ROOT, Site.sharding_dir(site.username), site.username, "#{path}.#{r}.jpg")).must_equal true
site.screenshot_url(path, r).must_equal(
_(File.exists?(File.join(Site::SCREENSHOTS_ROOT, Site.sharding_dir(site.username), site.username, "#{path}.#{r}.jpg"))).must_equal true
_(site.screenshot_url(path, r)).must_equal(
File.join(Site::SCREENSHOTS_URL_ROOT, Site.sharding_dir(site.username), site.username, "#{path}.#{r}.jpg")
)
end