2017-07-09 13:41:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-11 08:59:23 -04:00
|
|
|
require "cases/helper"
|
2015-09-05 20:48:15 -04:00
|
|
|
|
|
|
|
class ErrorsTest < ActiveRecord::TestCase
|
|
|
|
def test_can_be_instantiated_with_no_args
|
|
|
|
base = ActiveRecord::ActiveRecordError
|
|
|
|
error_klasses = ObjectSpace.each_object(Class).select { |klass| klass < base }
|
|
|
|
|
2016-12-29 12:50:01 -05:00
|
|
|
(error_klasses - [ActiveRecord::AmbiguousSourceReflectionForThroughAssociation]).each do |error_klass|
|
2018-12-20 12:44:01 -05:00
|
|
|
error_klass.new.inspect
|
|
|
|
rescue ArgumentError
|
|
|
|
raise "Instance of #{error_klass} can't be initialized with no arguments"
|
2015-09-05 20:48:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|