Skip to content

Commit

Permalink
Merge pull request #38428 from Edouard-chin/ec-fix-tos-casting
Browse files Browse the repository at this point in the history
Cast `ConfigurationFile#content_path` to a string:
  • Loading branch information
kaspth committed Feb 10, 2020
2 parents 94d2b29 + afb0220 commit 72d8bbf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/configuration_file.rb
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions activesupport/test/configuration_file_test.rb
Expand Up @@ -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

0 comments on commit 72d8bbf

Please sign in to comment.