mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add test for inheritance from a non-AR superclass
This commit is contained in:
parent
7293cac854
commit
8c67e709d0
2 changed files with 19 additions and 0 deletions
|
@ -6,6 +6,14 @@ class BasicInclusionModelTest < ActiveRecord::TestCase
|
||||||
Teapot.create!(:name => "Ronnie Kemper")
|
Teapot.create!(:name => "Ronnie Kemper")
|
||||||
assert_equal "Ronnie Kemper", Teapot.find(1).name
|
assert_equal "Ronnie Kemper", Teapot.find(1).name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_inherited_model
|
||||||
|
teapot = CoolTeapot.create!(:name => "Bob")
|
||||||
|
teapot.reload
|
||||||
|
|
||||||
|
assert_equal "Bob", teapot.name
|
||||||
|
assert_equal "mmm", teapot.aaahhh
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class InclusionUnitTest < ActiveRecord::TestCase
|
class InclusionUnitTest < ActiveRecord::TestCase
|
||||||
|
|
|
@ -11,3 +11,14 @@ class Teapot
|
||||||
|
|
||||||
include ActiveRecord::Model
|
include ActiveRecord::Model
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class OMFGIMATEAPOT
|
||||||
|
def aaahhh
|
||||||
|
"mmm"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class CoolTeapot < OMFGIMATEAPOT
|
||||||
|
include ActiveRecord::Model
|
||||||
|
self.table_name = "teapots"
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue