提交 0449d8b6 编写于 作者: K Kasper Timm Hansen 提交者: GitHub

Merge pull request #29894 from eugeneius/check_schema_file_dup_string

Avoid modifying frozen string in check_schema_file
......@@ -261,7 +261,7 @@ def load_schema_current(format = ActiveRecord::Base.schema_format, file = nil, e
def check_schema_file(filename)
unless File.exist?(filename)
message = %{#{filename} doesn't exist yet. Run `rails db:migrate` to create it, then try again.}
message = %{#{filename} doesn't exist yet. Run `rails db:migrate` to create it, then try again.}.dup
message << %{ If you do not intend to use a database, you should instead alter #{Rails.root}/config/application.rb to limit the frameworks that will be loaded.} if defined?(::Rails.root)
Kernel.abort message
end
......
......@@ -259,6 +259,13 @@ def db_structure_dump_and_load(expected_database)
end
end
test "db:schema:load fails if schema.rb doesn't exist yet" do
Dir.chdir(app_path) do
stderr_output = capture(:stderr) { `bin/rails db:schema:load` }
assert_match /Run `rails db:migrate` to create it/, stderr_output
end
end
def db_test_load_structure
Dir.chdir(app_path) do
`bin/rails generate model book title:string;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册