mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6fbd405a2e
If system test fails, it creates screenshot under `tmp/screenshots`.
34fe2a4fc7/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb (L45)
But currently, screenshot files is not cleared by `tmp:clear` task.
This patch make clears screenshot files with `tmp:clear` task as well
as other tmp files.
36 lines
903 B
Ruby
36 lines
903 B
Ruby
require "isolation/abstract_unit"
|
|
|
|
module ApplicationTests
|
|
module RakeTests
|
|
class TmpTest < ActiveSupport::TestCase
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
def setup
|
|
build_app
|
|
end
|
|
|
|
def teardown
|
|
teardown_app
|
|
end
|
|
|
|
test "tmp:clear clear cache, socket and screenshot files" do
|
|
Dir.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
|
|
end
|
|
end
|
|
end
|