aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@gmail.com>2015-09-08 08:13:57 -0400
committerEileen M. Uchitelle <eileencodes@gmail.com>2015-09-08 08:13:57 -0400
commit269050072d53bc34d779c4f807c444aacb08a61a (patch)
tree6133bb53d7f6b7e0d4bac19416e53241bb81b788 /activerecord/test
parente0cdc7c29d1afae9f0d86fc392cd40a9cf18efcf (diff)
parent4ff626cac901b41f86646dab1939d2a95b2d26bd (diff)
downloadrails-269050072d53bc34d779c4f807c444aacb08a61a.tar.gz
rails-269050072d53bc34d779c4f807c444aacb08a61a.tar.bz2
rails-269050072d53bc34d779c4f807c444aacb08a61a.zip
Merge pull request #21511 from rwz/ar-exceptions-no-args
Removes mandatory arguments from AR exceptions
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/errors_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/errors_test.rb b/activerecord/test/cases/errors_test.rb
new file mode 100644
index 0000000000..0711a372f2
--- /dev/null
+++ b/activerecord/test/cases/errors_test.rb
@@ -0,0 +1,16 @@
+require_relative "../cases/helper"
+
+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 }
+
+ error_klasses.each do |error_klass|
+ begin
+ error_klass.new.inspect
+ rescue ArgumentError
+ raise "Instance of #{error_klass} can't be initialized with no arguments"
+ end
+ end
+ end
+end