diff --git a/activesupport/lib/active_support/configuration_file.rb b/activesupport/lib/active_support/configuration_file.rb index 08eb5a5cd532b..7b062efd9ba17 100644 --- a/activesupport/lib/active_support/configuration_file.rb +++ b/activesupport/lib/active_support/configuration_file.rb @@ -10,7 +10,7 @@ class ConfigurationFile # :nodoc: class FormatError < StandardError; end def initialize(content_path) - @content_path = content_path + @content_path = content_path.to_s @content = read content_path end diff --git a/activesupport/test/configuration_file_test.rb b/activesupport/test/configuration_file_test.rb index 2d623f6d346ca..49f83c332b199 100644 --- a/activesupport/test/configuration_file_test.rb +++ b/activesupport/test/configuration_file_test.rb @@ -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