diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-09-10 10:43:09 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-10-14 08:52:35 +0900 |
commit | 447e1a48811fa053e8bef954376d1ad47bdb5cef (patch) | |
tree | 1f0b7c44ce772b2ea85095aa8580513b8f18b01f /railties/test | |
parent | e10e3c7da215ef848db7592068993f14aac00fa6 (diff) | |
download | rails-447e1a48811fa053e8bef954376d1ad47bdb5cef.tar.gz rails-447e1a48811fa053e8bef954376d1ad47bdb5cef.tar.bz2 rails-447e1a48811fa053e8bef954376d1ad47bdb5cef.zip |
clear all environments log files by default
In #22703, `log:clear` task has been changed to clear only standard environment
log files.
However, it is often to add a non-standard environment(e.g. "staging").
Therefore, I think than it is better to clear all environments log files by default.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake/log_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/railties/test/application/rake/log_test.rb b/railties/test/application/rake/log_test.rb new file mode 100644 index 0000000000..fdd3c71fe8 --- /dev/null +++ b/railties/test/application/rake/log_test.rb @@ -0,0 +1,33 @@ +require "isolation/abstract_unit" + +module ApplicationTests + module RakeTests + class LogTest < ActiveSupport::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + end + + def teardown + teardown_app + end + + test "log:clear clear all environments log files by default" do + Dir.chdir(app_path) do + File.open("config/environments/staging.rb", "w") + + File.write("log/staging.log", "staging") + File.write("log/test.log", "test") + File.write("log/dummy.log", "dummy") + + `rails log:clear` + + assert_equal 0, File.size("log/test.log") + assert_equal 0, File.size("log/staging.log") + assert_equal 5, File.size("log/dummy.log") + end + end + end + end +end |