mirror of https://github.com/rails/rails
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:
parent
94d2b29e86
commit
afb0220436
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue