2020-02-10 13:14:46 -05:00
|
|
|
# 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
|
2020-02-10 18:12:33 -05:00
|
|
|
|
|
|
|
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
|
2020-02-10 13:14:46 -05:00
|
|
|
end
|