diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-29 02:21:37 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-12-29 02:21:37 -0500 |
commit | 366f094598305074c4430fab581ddfd599c1cf96 (patch) | |
tree | 0017a57044ec8e466c97cc6b7879d39caa6c1ffa /railties/test | |
parent | fcec126eaa4f835c837bc75efa78008667b2ec5b (diff) | |
parent | eb6a6141a66e052deb58580448d7c0fa6aa675ba (diff) | |
download | rails-366f094598305074c4430fab581ddfd599c1cf96.tar.gz rails-366f094598305074c4430fab581ddfd599c1cf96.tar.bz2 rails-366f094598305074c4430fab581ddfd599c1cf96.zip |
Merge pull request #26443 from y-yagi/clear_all_environments_log_by_default
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 |