Skip to content

Commit

Permalink
Merge pull request #9765 from tkhr/mv-tests-out-from-base_testrb
Browse files Browse the repository at this point in the history
Move tests out from base_test.rb to inheritance_test.rb
  • Loading branch information
carlosantoniodasilva committed Mar 18, 2013
2 parents ddecdde + 4666108 commit 10bed60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 0 additions & 14 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -307,20 +307,6 @@ def test_initialize_with_invalid_attribute
assert_equal("last_read", ex.errors[0].attribute) assert_equal("last_read", ex.errors[0].attribute)
end 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 def test_create_after_initialize_without_block
cb = CustomBulb.create(:name => 'Dude') cb = CustomBulb.create(:name => 'Dude')
assert_equal('Dude', cb.name) assert_equal('Dude', cb.name)
Expand Down
14 changes: 14 additions & 0 deletions activerecord/test/cases/inheritance_test.rb
Expand Up @@ -172,6 +172,20 @@ def test_inheritance_new_with_subclass
assert_equal Firm, firm.class assert_equal Firm, firm.class
end 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 def test_new_with_invalid_type
assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'InvalidType') } assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'InvalidType') }
end end
Expand Down

0 comments on commit 10bed60

Please sign in to comment.