2019-07-24 23:51:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
require 'test_helper'
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
class DeployZipTest < ActiveSupport::TestCase
|
2021-08-07 21:25:54 +00:00
|
|
|
setup do
|
|
|
|
@site = create :site
|
|
|
|
@deploy_zip = @site.deploys.create(type: 'DeployZip')
|
|
|
|
end
|
|
|
|
|
|
|
|
teardown do
|
|
|
|
@site&.destroy
|
|
|
|
end
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2021-08-07 21:25:54 +00:00
|
|
|
test 'el nombre es el hostname.zip' do
|
|
|
|
assert_equal "#{@site.hostname}.zip", @deploy_zip.hostname
|
|
|
|
end
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2021-08-07 21:25:54 +00:00
|
|
|
test 'se puede deployear' do
|
|
|
|
# Primero tenemos que generar el sitio
|
|
|
|
assert @site.deploy_local.deploy
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2021-08-07 21:25:54 +00:00
|
|
|
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?
|
2019-07-24 23:51:29 +00:00
|
|
|
end
|
|
|
|
end
|