diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 1324cc1f6776d..96c49a81bb220 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -216,7 +216,7 @@ def create_root empty_directory '.' set_default_accessors! - FileUtils.cd(destination_root) + FileUtils.cd(destination_root) unless options[:pretend] end def create_root_files diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 67a878e926e48..1e0b3bf4c766f 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -58,6 +58,12 @@ def test_application_skeleton_is_created DEFAULT_APP_FILES.each{ |path| assert_file path } end + def test_application_generate_pretend + run_generator ["testapp", "--pretend"] + + DEFAULT_APP_FILES.each{ |path| assert_no_file path } + end + def test_application_controller_and_layout_files run_generator assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag :all/