aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2011-01-29 11:23:12 +0800
committerJosé Valim <jose.valim@gmail.com>2011-01-29 16:51:42 +0800
commit99f751ffef3e2feb6baf2778f66a32e86ae18956 (patch)
tree5834d8f84534227e2529727fa2c6f4bfe12424f9 /railties/test/generators
parenta812cb670795cf876d598bc17315b8077eb298ec (diff)
downloadrails-99f751ffef3e2feb6baf2778f66a32e86ae18956.tar.gz
rails-99f751ffef3e2feb6baf2778f66a32e86ae18956.tar.bz2
rails-99f751ffef3e2feb6baf2778f66a32e86ae18956.zip
Test non zero exit code and that a message still appears when generating inside an existing Rails directory.
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/app_generator_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index f04b14f0ca..018c2fa6bf 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -70,6 +70,17 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_equal false, $?.success?
end
+ def test_application_new_exits_with_message_and_non_zero_code_when_generating_inside_existing_rails_directory
+ app_root = File.join(destination_root, 'myfirstapp')
+ run_generator [app_root]
+ output = nil
+ Dir.chdir(app_root) do
+ output = `rails new mysecondapp`
+ end
+ assert_equal "Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.\nType 'rails' for help.\n", output
+ assert_equal false, $?.success?
+ end
+
def test_application_name_is_detected_if_it_exists_and_app_folder_renamed
app_root = File.join(destination_root, "myapp")
app_moved_root = File.join(destination_root, "myapp_moved")