Skip to content

Commit 10bed60

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
2 parents ddecdde + 4666108 commit 10bed60

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

activerecord/test/cases/base_test.rb

Lines changed: 0 additions & 14 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -307,20 +307,6 @@ def test_initialize_with_invalid_attribute
307
assert_equal("last_read", ex.errors[0].attribute)
307
assert_equal("last_read", ex.errors[0].attribute)
308
end
308
end
309

309

310-
def test_initialize_abstract_class
311-
e = assert_raises(NotImplementedError) do
312-
FirstAbstractClass.new
313-
end
314-
assert_equal("FirstAbstractClass is an abstract class and can not be instantiated.", e.message)
315-
end
316-
317-
def test_initialize_base
318-
e = assert_raises(NotImplementedError) do
319-
ActiveRecord::Base.new
320-
end
321-
assert_equal("ActiveRecord::Base is an abstract class and can not be instantiated.", e.message)
322-
end
323-
324
def test_create_after_initialize_without_block
310
def test_create_after_initialize_without_block
325
cb = CustomBulb.create(:name => 'Dude')
311
cb = CustomBulb.create(:name => 'Dude')
326
assert_equal('Dude', cb.name)
312
assert_equal('Dude', cb.name)

activerecord/test/cases/inheritance_test.rb

Lines changed: 14 additions & 0 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -172,6 +172,20 @@ def test_inheritance_new_with_subclass
172
assert_equal Firm, firm.class
172
assert_equal Firm, firm.class
173
end
173
end
174

174

175+
def test_new_with_abstract_class
176+
e = assert_raises(NotImplementedError) do
177+
AbstractCompany.new
178+
end
179+
assert_equal("AbstractCompany is an abstract class and can not be instantiated.", e.message)
180+
end
181+
182+
def test_new_with_ar_base
183+
e = assert_raises(NotImplementedError) do
184+
ActiveRecord::Base.new
185+
end
186+
assert_equal("ActiveRecord::Base is an abstract class and can not be instantiated.", e.message)
187+
end
188+
175
def test_new_with_invalid_type
189
def test_new_with_invalid_type
176
assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'InvalidType') }
190
assert_raise(ActiveRecord::SubclassNotFound) { Company.new(:type => 'InvalidType') }
177
end
191
end

0 commit comments

Comments
 (0)