mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
![Eugene Kenny](/assets/img/avatar_default.png)
5d7953f86b
https://buildkite.com/rails/rails/builds/71925#9839c015-e562-4145-932c-75b9c118bfca/1043-1055
44 lines
1.1 KiB
Ruby
44 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "isolation/abstract_unit"
|
|
require "chdir_helpers"
|
|
|
|
module ApplicationTests
|
|
module RakeTests
|
|
class TmpTest < ActiveSupport::TestCase
|
|
include ActiveSupport::Testing::Isolation, ChdirHelpers
|
|
|
|
def setup
|
|
build_app
|
|
end
|
|
|
|
def teardown
|
|
teardown_app
|
|
end
|
|
|
|
test "tmp:clear clear cache, socket and screenshot files" do
|
|
chdir(app_path) do
|
|
FileUtils.mkdir_p("tmp/cache")
|
|
FileUtils.touch("tmp/cache/cache_file")
|
|
|
|
FileUtils.mkdir_p("tmp/sockets")
|
|
FileUtils.touch("tmp/sockets/socket_file")
|
|
|
|
FileUtils.mkdir_p("tmp/screenshots")
|
|
FileUtils.touch("tmp/screenshots/fail.png")
|
|
|
|
rails "tmp:clear"
|
|
|
|
assert_not File.exist?("tmp/cache/cache_file")
|
|
assert_not File.exist?("tmp/sockets/socket_file")
|
|
assert_not File.exist?("tmp/screenshots/fail.png")
|
|
end
|
|
end
|
|
|
|
test "tmp:clear should work if folder missing" do
|
|
FileUtils.remove_dir("#{app_path}/tmp")
|
|
rails "tmp:clear"
|
|
end
|
|
end
|
|
end
|
|
end
|