Cast `ConfigurationFile#content_path` to a string:

- This is required when we assign the `ERB#filename` in case
  of a Pathname.
This commit is contained in:
Edouard CHIN 2020-02-10 19:12:33 -04:00
parent 94d2b29e86
commit afb0220436
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