1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

move tests out from base_test.rb

These tests should be in inheritance_test.rb since its testing a
feature which is implemented in inheritance.rb
This commit is contained in:
Takehiro Adachi 2013-03-18 15:45:39 +09:00
parent c4a7c31581
commit 4666108c68
2 changed files with 14 additions and 14 deletions

View file

@ -307,20 +307,6 @@ 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)

View file

@ -172,6 +172,20 @@ class InheritanceTest < ActiveRecord::TestCase
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