...
 
Commits (1)
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