提交 10bed609 编写于 作者: C Carlos Antonio da Silva

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

Move tests out from base_test.rb to 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册