diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2015-05-30 01:00:49 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2015-05-30 01:00:49 -0700 |
commit | d7cbdbef1857f1359201234e02933ba3bfed2a14 (patch) | |
tree | 68892974178b78cc3566578438862934266feffc /railties/test/application | |
parent | 109e71d2bb6d2305a091fe7ea96d4f6e9c7cd52d (diff) | |
parent | 0cb327c549282548639696f86aeac97a4e48e9f1 (diff) | |
download | rails-d7cbdbef1857f1359201234e02933ba3bfed2a14.tar.gz rails-d7cbdbef1857f1359201234e02933ba3bfed2a14.tar.bz2 rails-d7cbdbef1857f1359201234e02933ba3bfed2a14.zip |
Merge pull request #20370 from manishspuri/master
Add tmp directory before touching
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/rake/restart_test.rb | 12 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 7 |
2 files changed, 17 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 diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index de14f269df..dd26ec867d 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -285,5 +285,12 @@ module ApplicationTests assert_match(/Hello, World!/, output) end + + def test_tmp_clear_should_work_if_folder_missing + FileUtils.remove_dir("#{app_path}/tmp") + errormsg = Dir.chdir(app_path) { `bundle exec rake tmp:clear` } + assert_predicate $?, :success? + assert_empty errormsg + end end end |