diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-07 17:57:52 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-07 17:57:52 +0200 |
commit | 98baa827ac5e3a7e0fd427febed066d013198371 (patch) | |
tree | 43a134504d5e25024d3f38d5fc114840180c92e8 | |
parent | 4346102172b656b93ed4213922df5ed30cbc6fa8 (diff) | |
download | rails-98baa827ac5e3a7e0fd427febed066d013198371.tar.gz rails-98baa827ac5e3a7e0fd427febed066d013198371.tar.bz2 rails-98baa827ac5e3a7e0fd427febed066d013198371.zip |
test, persist inherited class with different table name. Refs #14971.
This case prevents against regressions. The change was suggested in a recent
PR but the all our tests passed.
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 823146b399..5d963098fb 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -1,4 +1,5 @@ require "cases/helper" +require 'models/aircraft' require 'models/post' require 'models/comment' require 'models/author' @@ -829,4 +830,17 @@ class PersistenceTest < ActiveRecord::TestCase end end + def test_persist_inherited_class_with_different_table_name + minimalistic_aircrafts = Class.new(Minimalistic) do + self.table_name = "aircraft" + end + + assert_difference "Aircraft.count", 1 do + aircraft = minimalistic_aircrafts.create(name: "Wright Flyer") + aircraft.name = "Wright Glider" + aircraft.save + end + + assert_equal "Wright Glider", Aircraft.last.name + end end |