2019-07-24 23:51:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
class DeployLocalTest < ActiveSupport::TestCase
|
2019-07-24 23:51:29 +00:00
|
|
|
test 'se puede deployear' do
|
2019-10-01 19:41:33 +00:00
|
|
|
site = create :site
|
|
|
|
local = create :deploy_local, site: site
|
|
|
|
deploy = create :deploy_zip, site: site
|
|
|
|
|
|
|
|
# Primero tenemos que generar el sitio
|
|
|
|
local.deploy
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
escaped_path = Shellwords.escape(deploy.path)
|
2019-07-26 00:07:53 +00:00
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
assert deploy.deploy
|
|
|
|
assert File.file?(deploy.path)
|
|
|
|
assert_equal 'application/zip',
|
|
|
|
`file --mime-type "#{escaped_path}"`.split(' ').last
|
|
|
|
assert_equal 1, deploy.build_stats.count
|
|
|
|
assert deploy.build_stats.map(&:bytes).inject(:+).positive?
|
|
|
|
assert deploy.build_stats.map(&:seconds).inject(:+).positive?
|
2019-07-24 23:51:29 +00:00
|
|
|
|
2019-10-01 19:41:33 +00:00
|
|
|
local.destroy
|
2019-07-24 23:51:29 +00:00
|
|
|
end
|
|
|
|
end
|