From 03a74091c7b1193d9bc4e647bb234609dcc5975a Mon Sep 17 00:00:00 2001 From: rohit Date: Mon, 2 Aug 2010 13:42:35 +0530 Subject: [PATCH] Failing test to check for route file corruption if legacy map parameter is used. [#5263 state:open] --- .../test/generators/scaffold_generator_test.rb | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index ea469cb..f12445a 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -216,4 +216,19 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase # Stylesheets (should not be removed) assert_file "public/stylesheets/scaffold.css" end + + def test_scaffold_generator_on_revoke_does_not_mutilate_legacy_map_parameter + run_generator + + # Add a |map| parameter to the routes block manually + route_path = File.expand_path("config/routes.rb", destination_root) + content = File.read(route_path).gsub(/\.routes\.draw do/) do |match| + "#{match} |map|" + end + File.open(route_path, "wb") { |file| file.write(content) } + + run_generator ["product_line"], :behavior => :revoke + + assert_file "config/routes.rb", /\.routes\.draw do\s*\|map\|\s*$/ + end end -- 1.7.0.4