1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/configuration_file_test.rb
Edouard CHIN afb0220436 Cast ConfigurationFile#content_path to a string:
- This is required when we assign the `ERB#filename` in case
  of a Pathname.
2020-02-10 19:12:33 -04:00

31 lines
744 B
Ruby

# frozen_string_literal: true
require_relative "abstract_unit"
class ConfigurationFileTest < ActiveSupport::TestCase
test "backtrace contains yaml path" do
Tempfile.create do |file|
file.write("wrong: <%= foo %>")
file.rewind
error = assert_raises do
ActiveSupport::ConfigurationFile.parse(file.path)
end
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