From b181297ad7f60c6006292ab024ed08a490bdb4f8 Mon Sep 17 00:00:00 2001 From: Hyonjee Joo Date: Tue, 17 Feb 2015 01:11:16 -0500 Subject: Created rake restart task. Fixes #18876. Rake restart touches `tmp/restart.txt` to restart application on next request. Updated tests and documentation accordingly. --- railties/test/application/rake/restart_test.rb | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 railties/test/application/rake/restart_test.rb (limited to 'railties/test/application/rake/restart_test.rb') diff --git a/railties/test/application/rake/restart_test.rb b/railties/test/application/rake/restart_test.rb new file mode 100644 index 0000000000..35099913fb --- /dev/null +++ b/railties/test/application/rake/restart_test.rb @@ -0,0 +1,31 @@ +require "isolation/abstract_unit" + +module ApplicationTests + module RakeTests + class RakeRestartTest < ActiveSupport::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + end + + def teardown + teardown_app + end + + test 'rake restart touches tmp/restart.txt' do + Dir.chdir(app_path) do + `rake restart` + assert File.exist?("tmp/restart.txt") + + prev_mtime = File.mtime("tmp/restart.txt") + sleep(1) + `rake restart` + curr_mtime = File.mtime("tmp/restart.txt") + assert_not_equal prev_mtime, curr_mtime + end + end + end + end +end -- cgit v1.2.3