Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 98baa827ac5e3a7e0fd427febed066d013198371 1 parent 4346102
@senny senny authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 activerecord/test/cases/persistence_test.rb
View
14 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 @@ def test_create_with_custom_timestamps
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
Please sign in to comment.
Something went wrong with that request. Please try again.