Permalink
Browse files

Merge pull request #9765 from tkhr/mv-tests-out-from-base_testrb

Move tests out from base_test.rb to inheritance_test.rb
  • Loading branch information...
2 parents ddecdde + 4666108 commit 10bed60900319d4a35015d9e81ca49a186dd43d9 @carlosantoniodasilva carlosantoniodasilva committed Mar 18, 2013
Showing with 14 additions and 14 deletions.
  1. +0 −14 activerecord/test/cases/base_test.rb
  2. +14 −0 activerecord/test/cases/inheritance_test.rb
@@ -307,20 +307,6 @@ def test_initialize_with_invalid_attribute
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)
@@ -172,6 +172,20 @@ def test_inheritance_new_with_subclass
assert_equal Firm, firm.class
end
+ def test_new_with_abstract_class
+ e = assert_raises(NotImplementedError) do
+ AbstractCompany.new
+ end
+ assert_equal("AbstractCompany is an abstract class and can not be instantiated.", e.message)
+ end
+
+ def test_new_with_ar_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_new_with_invalid_type
assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'InvalidType') }
end

0 comments on commit 10bed60

Please sign in to comment.