diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-07 13:26:03 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-07 13:26:03 -0300 |
commit | d3adfd6d3b6bb07f4e4d56b017eff1ff740523ff (patch) | |
tree | 03a5a3e4db0a4d51188a5114b1223179eb56c5ed /activerecord/test/cases | |
parent | cf09ac380e7d786d0d688983fb2080dc693f65a1 (diff) | |
parent | 53f18f2c5475809f7f6c5576aba89d6340a57c06 (diff) | |
download | rails-d3adfd6d3b6bb07f4e4d56b017eff1ff740523ff.tar.gz rails-d3adfd6d3b6bb07f4e4d56b017eff1ff740523ff.tar.bz2 rails-d3adfd6d3b6bb07f4e4d56b017eff1ff740523ff.zip |
Merge pull request #9474 from HonoreDB/master
More helpful error message when instantiating an abstract class
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index af1845c937..8e6e462404 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -307,6 +307,20 @@ class BasicsTest < ActiveRecord::TestCase assert_equal("last_read", ex.errors[0].attribute) end + def test_initialize_abstract_class + e = assert_raises(NotImplementedError) do + FirstAbstractClass.new + end + assert_equal("FirstAbstractClass is an abstract class and can not be instantiated.", e.message) + end + + def test_initialize_base + e = assert_raises(NotImplementedError) do + ActiveRecord::Base.new + end + assert_equal("ActiveRecord::Base is an abstract class and can not be instantiated.", e.message) + end + def test_create_after_initialize_without_block cb = CustomBulb.create(:name => 'Dude') assert_equal('Dude', cb.name) |