Skip to content

Commit c544fcc

Browse files
rohitspastorino
authored andcommitted
Failing test to check for route file corruption if legacy map parameter is used. [rails#5263 state:open]
1 parent 3b44b52 commit c544fcc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

railties/test/generators/scaffold_generator_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,19 @@ def test_scaffold_with_namespace_on_revoke
216216
# Stylesheets (should not be removed)
217217
assert_file "public/stylesheets/scaffold.css"
218218
end
219+
220+
def test_scaffold_generator_on_revoke_does_not_mutilate_legacy_map_parameter
221+
run_generator
222+
223+
# Add a |map| parameter to the routes block manually
224+
route_path = File.expand_path("config/routes.rb", destination_root)
225+
content = File.read(route_path).gsub(/\.routes\.draw do/) do |match|
226+
"#{match} |map|"
227+
end
228+
File.open(route_path, "wb") { |file| file.write(content) }
229+
230+
run_generator ["product_line"], :behavior => :revoke
231+
232+
assert_file "config/routes.rb", /\.routes\.draw do\s*\|map\|\s*$/
233+
end
219234
end

0 commit comments

Comments
 (0)