aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorYoong Kang Lim <yoongkang.lim@gmail.com>2015-05-26 20:47:36 +1000
committerGodfrey Chan <godfreykfc@gmail.com>2015-05-30 00:44:05 -0700
commit6fc83f8efeb1637af5d17b0d7b0c4b2e3db3c001 (patch)
tree0fa0e8406e84c169bad8abad344ac7e1fc0b8a64 /railties/test
parent109e71d2bb6d2305a091fe7ea96d4f6e9c7cd52d (diff)
downloadrails-6fc83f8efeb1637af5d17b0d7b0c4b2e3db3c001.tar.gz
rails-6fc83f8efeb1637af5d17b0d7b0c4b2e3db3c001.tar.bz2
rails-6fc83f8efeb1637af5d17b0d7b0c4b2e3db3c001.zip
`rake restart` should work without a `tmp` folder
In restart.rake, the creation of tmp/restart.txt would fail if the tmp folder does not exist in the app. This is a problem because apps cloned using git would not have the tmp folder, as the folder is in .gitignore. This commit creates the tmp folder if it does not exist. Fixes #20299 [Yoong Kang Lim, Sunny Juneja]
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/rake/restart_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/railties/test/application/rake/restart_test.rb b/railties/test/application/rake/restart_test.rb
index 35099913fb..4cae199e6b 100644
--- a/railties/test/application/rake/restart_test.rb
+++ b/railties/test/application/rake/restart_test.rb
@@ -13,12 +13,12 @@ module ApplicationTests
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`
@@ -26,6 +26,14 @@ module ApplicationTests
assert_not_equal prev_mtime, curr_mtime
end
end
+
+ test 'rake restart should work even if tmp folder does not exist' do
+ Dir.chdir(app_path) do
+ FileUtils.remove_dir('tmp')
+ `rake restart`
+ assert File.exist?('tmp/restart.txt')
+ end
+ end
end
end
end