Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29534 from y-yagi/clear_screenshots_in_tmp_clear_…
…task Clear screenshots files in `tmp:clear` task
- Loading branch information
Showing
4 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 |