Skip to content

Commit 97382b4

Browse files
committed
Refactor copy_routes in generators_test_helper.rb to evaluate routes template instead of copy directly because we now include tempate condition code in routes file
Signed-off-by: chunli <[email protected]>
1 parent a0b9ea4 commit 97382b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

railties/test/generators/generators_test_helper.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ def with_database_configuration(database_name = "secondary")
6262

6363
def copy_routes
6464
routes = File.expand_path("../../lib/rails/generators/rails/app/templates/config/routes.rb.tt", __dir__)
65+
routes = evaluate_template(routes, {
66+
options: ActiveSupport::OrderedOptions.new
67+
})
6568
destination = File.join(destination_root, "config")
6669
FileUtils.mkdir_p(destination)
67-
FileUtils.cp routes, File.join(destination, "routes.rb")
70+
File.write File.join(destination, "routes.rb"), routes
6871
end
6972

7073
def copy_gemfile(*gemfile_entries)

0 commit comments

Comments
 (0)