未验证 提交 36b76556 编写于 作者: E eileencodes

Fix missing backticks in errors

These weren't consistent. In some errors we were using backticks and
others we weren't. This fixes `connects_to` errors to use backticks
around the method name
上级 0bce8134
......@@ -79,10 +79,10 @@ def establish_connection(config_or_env = nil)
#
# Returns an array of database connections.
def connects_to(database: {}, shards: {})
raise NotImplementedError, "connects_to can only be called on ActiveRecord::Base or abstract classes" unless self == Base || abstract_class?
raise NotImplementedError, "`connects_to` can only be called on ActiveRecord::Base or abstract classes" unless self == Base || abstract_class?
if database.present? && shards.present?
raise ArgumentError, "connects_to can only accept a `database` or `shards` argument, but not both arguments."
raise ArgumentError, "`connects_to` can only accept a `database` or `shards` argument, but not both arguments."
end
connections = []
......
......@@ -1666,7 +1666,7 @@ def test_protected_environments_are_stored_as_an_array_of_string
Bird.connects_to(database: { writing: :arunit })
end
assert_equal "connects_to can only be called on ActiveRecord::Base or abstract classes", error.message
assert_equal "`connects_to` can only be called on ActiveRecord::Base or abstract classes", error.message
end
test "cannot call connected_to on subclasses of ActiveRecord::Base" do
......
......@@ -233,7 +233,7 @@ def test_connects_to_raises_with_a_shard_and_database_key
error = assert_raises(ArgumentError) do
ActiveRecord::Base.connects_to(database: { writing: :arunit }, shards: { shard_one: { writing: :arunit } })
end
assert_equal "connects_to can only accept a `database` or `shards` argument, but not both arguments.", error.message
assert_equal "`connects_to` can only accept a `database` or `shards` argument, but not both arguments.", error.message
end
def test_retrieve_connection_pool_with_invalid_shard
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册