mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge branch 'master' of github.com:rails/rails
This commit is contained in:
@@ -275,7 +275,7 @@ module Rails
|
||||
#
|
||||
def route(routing_code)
|
||||
log :route, routing_code
|
||||
sentinel = /\.routes\.draw do(\s*\|map\|)?\s*$/
|
||||
sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
|
||||
|
||||
in_root do
|
||||
inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user