Merge pull request #38428 from Edouard-chin/ec-fix-tos-casting

Cast `ConfigurationFile#content_path` to a string:
This commit is contained in:
Kasper Timm Hansen 2020-02-11 00:25:55 +01:00 committed by GitHub
commit 72d8bbfcd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -10,7 +10,7 @@ module ActiveSupport
class FormatError < StandardError; end
def initialize(content_path)
@content_path = content_path
@content_path = content_path.to_s
@content = read content_path
end

View File

@ -15,4 +15,17 @@ class ConfigurationFileTest < ActiveSupport::TestCase
assert_match file.path, error.backtrace.first
end
end
test "backtrace contains yaml path (when Pathname given)" do
Tempfile.create do |file|
file.write("wrong: <%= foo %>")
file.rewind
error = assert_raises do
ActiveSupport::ConfigurationFile.parse(Pathname(file.path))
end
assert_match file.path, error.backtrace.first
end
end
end