5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-01 12:26:07 +00:00
panel/test/models/deploy_zip_test.rb
2021-08-07 18:25:54 -03:00

32 lines
839 B
Ruby

# frozen_string_literal: true
require 'test_helper'
class DeployZipTest < ActiveSupport::TestCase
setup do
@site = create :site
@deploy_zip = @site.deploys.create(type: 'DeployZip')
end
teardown do
@site&.destroy
end
test 'el nombre es el hostname.zip' do
assert_equal "#{@site.hostname}.zip", @deploy_zip.hostname
end
test 'se puede deployear' do
# Primero tenemos que generar el sitio
assert @site.deploy_local.deploy
assert @deploy_zip.deploy
assert File.file?(@deploy_zip.path)
assert_equal 'application/zip',
`file --mime-type "#{@deploy_zip.path}"`.split.last
assert_equal 1, @deploy_zip.build_stats.count
assert @deploy_zip.build_stats.map(&:bytes).inject(:+).positive?
assert @deploy_zip.build_stats.map(&:seconds).inject(:+).positive?
end
end