From 447e1a48811fa053e8bef954376d1ad47bdb5cef Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 10 Sep 2016 10:43:09 +0900 Subject: 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. --- railties/test/application/rake/log_test.rb | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 railties/test/application/rake/log_test.rb (limited to 'railties/test/application/rake') 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 -- cgit v1.2.3