aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/rake
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/rake')
-rw-r--r--railties/test/application/rake/framework_test.rb48
-rw-r--r--railties/test/application/rake/restart_test.rb12
2 files changed, 58 insertions, 2 deletions
diff --git a/railties/test/application/rake/framework_test.rb b/railties/test/application/rake/framework_test.rb
new file mode 100644
index 0000000000..ec57af79f6
--- /dev/null
+++ b/railties/test/application/rake/framework_test.rb
@@ -0,0 +1,48 @@
+require "isolation/abstract_unit"
+require "active_support/core_ext/string/strip"
+
+module ApplicationTests
+ module RakeTests
+ class FrameworkTest < ActiveSupport::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ boot_rails
+ FileUtils.rm_rf("#{app_path}/config/environments")
+ end
+
+ def teardown
+ teardown_app
+ end
+
+ def load_tasks
+ require 'rake'
+ require 'rdoc/task'
+ require 'rake/testtask'
+
+ Rails.application.load_tasks
+ end
+
+ test 'requiring the rake task should not define method .app_generator on Object' do
+ require "#{app_path}/config/environment"
+
+ load_tasks
+
+ assert_raise NameError do
+ Object.method(:app_generator)
+ end
+ end
+
+ test 'requiring the rake task should not define method .invoke_from_app_generator on Object' do
+ require "#{app_path}/config/environment"
+
+ load_tasks
+
+ assert_raise NameError do
+ Object.method(:invoke_from_app_generator)
+ end
+ end
+ end
+ end
+end
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