Commit f6df6129 authored by azul's avatar azul

test: add tests from previous dev steps

Used these tests in developing things but forgot to add them.
parent 441b6898
require 'test_helper'
class PostPolicyTest < ActiveSupport::TestCase
def test_admin_may_delete_visitor_comment
admin = users(:blue)
visitor = users(:penguin)
page = FactoryBot.create :page, created_by: admin,
owner: groups(:rainbow),
public: true
visitor_comment = page.add_post visitor,
body: 'test comment by penguin on public page'
policy = Pundit.policy!(admin, visitor_comment)
assert policy.destroy?
end
end
require 'test_helper'
class Asset::PdfTest < ActiveSupport::TestCase
def setup
setup_assets
end
def teardown
teardown_assets
end
def test_corrupt_file_upload
@asset = Asset.create_from_params uploaded_data: upload_data('corrupt.jpg')
@asset.generate_thumbnails
@asset.thumbnails.each do |thumb|
refute thumb.ok?, format('thumbnail "%s" should have failed for corrupt file', thumb.name)
assert thumb.private_filename, format('thumbnail "%s" should exist', thumb.name)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment